The src/parse Directory
Namespace parse, delivered during TC-1/2 and TC-EXTS.
Scan and parse Tiger programs.
File: local.am (src/parse/)
The Makefile configuration relative to the
src/parse/directory. It is responsible for the generation of the scanner and parser, the integration into thelibtclibrary with everything exported from theparsemodule, and the linkage of the directory’s unit tests in the test-suite.
File: libparse.* (src/parse/)
The interface of the
parsemodule. It exports theparseprocedure and wrappers around it.
File: tasks.* (src/parse/)
The tasks relative to the
parsemodule (see: The src/task Directory).
File: fwd.hh (src/parse/)
Forward declarations for the
parsemodule.
File: location.hh (src/parse/)
Keeps track of a range (two cursors) in a (or two) file. It is generated by Bison.
File: metavar-map.* (src/parse/)
Maps metavariables with
ASTnodes. Works in pair withtweasts.
File: parsetiger.yy (src/parse/)
Bison directives to describe our grammar and our parser.
File: parsetiger.* (src/parse/)
The generated parser.
File: parsetiger.{output|xml|html} (src/parse/)
Generated reports on the parser automaton. Contains tokens, states, conflicts and counter-examples. The
xmlis used to generate thehtmlwhich is easier to read and navigate.
File: parsetiger.stamp (src/parse/)
Generated stamp used by
bison++.into avoid useless regeneration and gain time (see The build-aux Directory).
File: scantiger.ll (src/parse/)
RE/flex directives to describe our tokens and our scanner.
File: scantiger.* (src/parse/)
The generated scanner.
File: tweast.* (src/parse/)
TWEAST stands for
Text With Embedded AST. It works in pair withmetavarmap.*and permits to use a string withASTnodes (stored as metavariables) as a parser input.The tweasts were born out of Project Tiger and led to a research paper.
For example, if we see the
_mainfunction added with the Tweast:Tweast in; in << "function _main() = (" << *exp << "; ())"; res = td.parse(in);
expis theASTreturned by the parser above.td.parse(...)runs the parsing on thetweastand produces the correspondingAST.Some files are given at TC-1/2.
File: tiger-driver.* (src/parse/)
Given at TC-1/2. A class which drives the lexing and parsing of input files.
File: generate-prelude.sh (src/parse/)
Generate the Tiger prelude (builtin primitives as a string).
File: prelude.cc (src/parse/)
Given at TC-1/2. It contains the builtin primitives of Tiger as a string. They will be inserted before the input code using a
tweastif--no-preludenor-Xis activated.
File: tiger-factory.* (src/parse/)
Given at TC-1/2. It is a factory containing functions for
ASTnodes creation and deletion.
File: test-{parse|tweast}.cc (src/parse/)
Given at TC-1/2. The unit tests.