home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v941.tgz
/
icon.v941src.tar
/
icon.v941src
/
ipl
/
packs
/
euler
/
semstk.icn
< prev
next >
Wrap
Text File
|
2001-06-06
|
780b
|
56 lines
# Semantics stack manipulation routines to be called by
# parseLL1(...), the parser for the TLCLL1 LL(1) parser
# generator.
# (written by Dr. Thomas W. Christopher)
#
global semanticsStack
record ErrorToken(type,body,line,column)
procedure initSemanticsStack()
semanticsStack:=[]
return
end
procedure outToken(tok)
push(semanticsStack,tok)
return
end
procedure outAction(a)
a()
return
end
procedure outError(t,l,c)
push(semanticsStack,ErrorToken(t,t,\l|0,\c|0))
return
end
procedure isError(v)
return type(v)=="ErrorToken"
end
procedure popSem(n)
local V
V:=[]
every 1 to n do push(V,pop(semanticsStack))
return V
end
procedure pushSem(s)
push(semanticsStack,s)
return
end
procedure anyError(V)
local v
if v:=!V & type(v)=="ErrorToken" then {
return v
}
fail
end