The src/parse
Directory
Namespace parse
. Delivered during TC-1 and TC-2.
File: local.am
This is a Makefile relative to the
parse/
directory. It is responsible for the generation of the scanner and parser, the creation of thelibparse
library containing everything exported from theparse
module, and the linkage of the directory’s unit tests in the test-suite.
File: fwd.hh
Forward declarations for the parse module.
File: libparse.{cc|hh}
Functions and variables exported by the parse module such as the
parse
procedure and wrappers around it.
File: tasks.{cc|hh}
Tasks related to the
Parse
module (See: The src/task Directory).
File: parsetiger.yy
Bison directives to describe our grammar and our parser.
File: parsetiger.{cc|hh}
The generated parser.
File: parsetiger.{output|xml|html}
Generated reports on the parser automaton. Contains tokens, states, conflicts and counter-examples. The
xml
is used to generate thehtml
which is easier to read and navigate.
File: parsetiger.stamp
Generated stamp used by
bison++.in
to avoid useless regeneration and gain time (See The build-aux Directory).
File: scantiger.ll
RE/Flex directives to describe our tokens and our scanner.
File: scantiger.{cc|hh}
The generated scanner.
File: location.hh
Keeps track of a range (two cursors) in a (or two) file. It is generated by bison.
File: metavar-map.{hh|hxx}
Maps metavariables with AST nodes. Works in pair with tweasts.
File: tweast.{cc|hh}
TWEAST stands for
Text With Embedded AST
. It works in pair withmetavarmap.{hh|hxx}
and permits to use a string with AST nodes (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 _main function added with the Tweast:
Tweast in; in << "function _main() = (" << *exp << "; ())"; res = td.parse(in);
exp
is the AST returned by the parser above.td.parse(...)
runs the parsing on the tweast and produces the corresponding ast.Some files are given at TC-2.
File: tiger-factory.{hh|hxx}
Given at TC-2. It is a factory containing functions for AST nodes creation and deletion.
File: tiger-driver.{hh|cc}
Given at TC-1. A class which drives the lexing and parsing of input files.
File: prelude.cc
Given at TC-2. It contains the builtin primitives of Tiger as a string. They will be inserted before the input code using a tweast if
--no-prelude
nor-X
is activated.
File: test-{parse|tweast}.cc
Given at TC-2. Unit tests.