Browse Source

Delete interp.sol

Benjamin Lannon 5 years ago
parent
commit
18caf1795e
1 changed files with 0 additions and 85 deletions
  1. 0
    85
      interp.sol

+ 0
- 85
interp.sol View File

@@ -1,86 +0,0 @@
1
-
2
-print('Solterpreter/Viperpreter v0.1')
3
-print('(Runtime version ', debug.version, ')')
4
-
5
-__interp = {
6
-	running = 1,
7
-	buffer = '',
8
-	ps1 = '>>> ',
9
-	ps2 = '... ',
10
-	stmt_stack=0,
11
-}
12
-
13
-func exit()
14
-	__interp.running=0
15
-end
16
-
17
-quit = exit
18
-
19
-while __interp.running do
20
-	if #__interp.buffer then
21
-		__interp.prompt = __interp.ps2
22
-	else
23
-		__interp.prompt = __interp.ps1
24
-	end
25
-	__interp.line = readline.readline(__interp.prompt)
26
-	if #__interp.line then readline.add_history(__interp.line) end
27
-	--prepr(__interp.line)
28
-	--prepr(__interp)
29
-	if (__interp.line:sub(-4, None)=="then") then
30
-		__interp.buffer+=__interp.line+" "
31
-		__interp.stmt_stack+=1
32
-	else
33
-		if (__interp.line:sub(-2, None)=="do") then
34
-			__interp.buffer+=__interp.line+" "
35
-			__interp.stmt_stack-=1
36
-		else
37
-			if __interp.line:sub(-1, None)=="\" then
38
-				__interp.buffer+=__interp.line:sub(0, -1)+" "
39
-			else
40
-				__interp.buffer+=__interp.line+" "
41
-				if __interp.line:sub(-3, None)=="end" then
42
-					__interp.stmt_stack-=1
43
-				end
44
-				if __interp.stmt_stack<=0 then
45
-					__interp.stmt_stack=0
46
-					__interp.program = try(parse, __interp.buffer)
47
-					if !__interp.program[0] then
48
-						print('Syntax error')
49
-					else
50
-						if !(try(func() __interp.program[1].stmtlist[0].type end)[0]) then
51
-							print('NULL program error')
52
-						else
53
-							if __interp.program[1].stmtlist[0].type == ast.ST_EXPR then
54
-								__interp.program[1] = __interp.program[1].stmtlist[0].expr
55
-								__interp.isexpr = 1
56
-							else
57
-								__interp.isexpr = 0
58
-							end
59
-							__interp.result = try(__interp.program[1])
60
-							if !__interp.result[0] then
61
-								print(__interp.result[1])
62
-								print(__interp.result[2])
63
-								for ent in __interp.result[2] do
64
-									st = ent[0]
65
-									scope = ent[1]
66
-									if st.type == ast.ST_LIST then continue end
67
-									print('In', st, 'at', st.loc.line, ',', st.loc.col, ':')
68
-									ast.print(st)
69
-									print(scope)
70
-									print('---')
71
-								end
72
-							else
73
-								if __interp.isexpr then
74
-									prepr(__interp.result[1])
75
-									_ = __interp.result[1]
76
-								end
77
-							end
78
-						end
79
-					end
80
-					__interp.buffer=''
81
-				end
82
-			end
83
-		end
84
-	end
85
-end

Loading…
Cancel
Save