1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
link eulerscn,readll1 #,parsell1
global primTbl
procedure main(L)
local filename,flags,splitFilename
local ptbl
#write("hi")
#&trace:=-1
if *L<1 then
stop("usage: [iconx] euler [-s] filename.eul")
flags := ""
if L[1][1]=="-" then {
flags := L[1]
filename := L[2]
} else {
filename:=L[1]
}
if /filename then
stop("usage: [iconx] euler [-s] filename.eul")
splitFilename:=fileSuffix(filename)
if \splitFilename[2] then initScanner(filename)
else initScanner(splitFilename[1]||".eul")
initSemanticsStack()
initTrans()
#write("before readLL1")
ptbl:=readLL1("euler.ll1")
#write("after readLL1")
parseLL1(ptbl)
if find("s",flags) then showCode()
interpreter()
end
# From: filename.icn in Icon Program Library
# Author: Robert J. Alexander, 5 Dec. 89
# Modified: Thomas Christopher, 12 Oct. 94
procedure fileSuffix(s,separator)
local i
/separator := "."
i := *s + 1
every i := find(separator,s)
return [s[1:i],s[(*s >= i) + 1:0] | &null]
end
#
#required by parseLL1()
#
procedure reportParseError(t)
write("unexpected input ",t.body,
" at line ",t.line," column ",t.column)
return
end
|