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
