Please, familiarize yourself with the code that is already there.
Copy your working tiger.lex from assignment 3
into as4. If your lexer is not working, then do NOT
copy it into as4. In this
case, CM.make(); will automatically use the file
tiger.lex.sml that is provided.
As in assignment 3, your tiger.lex should contain the
In the first section:
type svalue = Tokens.svalue
type pos = int
type ('a,'b) token = ('a,'b) Tokens.token
type lexresult = (svalue, pos) token
Copy your working tiger.grm from assignment 3
into as4. Add useful type definitions to the
Add semantic actions to your grammar rules to produce the Absyn
tree that corresponds to the Tiger program being parsed.
Fields of type bool ref that are named
escape should be initialized to ref
true. Likewise, the slmode ref in the
definition of dec must be initialized to ref
EscapingSL. (Later analyses may provide less conservative
approximations, but they are not part of this assignment.)
Compile using CM.make(); This will automatically
run ml-lex and ml-yacc as necessary.
Test your parser by invoking
This will invoke the parser and, upon completion, print the resulting
Absyn tree. Debug, edit, recompile, test. Repeat.