xmpl
subdirectory of the tiger-front
package. After you have built the compiler or other components, you can automatically test them using various make
targets.
For example, there is a test case called queens.tig
that computes the solutions to the Eight Queens Problem. Running make queens.tas
will parse and desugar it into queens.tas
, make queens.tc.tas
will typecheck it, etc.
The targets include:
filename.tasfix
(from filename.tig
) - the full parse tree (concrete syntax)
filename.sweettas
(from filename.tasfix
) - the imploded parse tree (abstract syntax)
filename.tas
(from filename.sweettas
) - the desugared abstract syntax
filename.tas.check
(from filename.tas
) - checks the validity of abstract syntax trees
filename.tc.tas
(from filename.tas
) - the abstract syntax annotated with type information; fails in case of a type error
filename.tc.tas.tccheck
(from filename.tas
) - checks the validity of type annotated abstract syntax trees
filename.val.tas
(from filename.tas
and filename.input
) - interprets a desugared Tiger program, with filename.input
as input
filename.flattas
(from filename.tas
) - resugared abstract syntax
filename.abox
(from filename.flattas
) - intermediate step for pretty-printing
filename.txt
(from filename.abox
) - pretty-printed Tiger code (i.e., translates abstract syntax back to concrete syntax)
Also see the CompilerArchitecture for a picture of how these file types relate to each other and what programs are involved in producing them.