4.2 T0, Naive Scanner and Parser
2006-T0 delivery is Wednesday, February 4th 2004 at noon.
This section has been updated for EPITA-2006.
T0 is a weak form of T1: the scanner and the parser are written, but
there is a set of simplifications:
- the hierarchy
- We don't need several directories, you can program in the top level of
the package.
- the build
- The GNU Build System is not used: there is no need for Autoconf,
Automake etc.
- no driver
- The driver is reduced to its simplest form:
int
main (int argc, const char *argc[])
{
assert (argc == 1);
yyin = fopen (argv[1]);
assert (yyin);
return !!yyparse ();
}
i.e., there is no support for options at all. But of course the exit
status must conform to the Tiger Compiler Reference Manual.
SCAN
, PARSE
- There is no support for options, but that does not mean that you cannot
use the tracing/debugging features from Flex/Bison. It is required that
you bind tracing to the environment variables
SCAN
and
PARSE
. I.e., running
PARSE=1 ./tc foo.tig
will set yydebug
to 1, which causes the traces of the parsing to
be displayed.
YYPRINT
- There is no requirement to implement
YYPRINT
support.
yylval
- All the values are supported: strings, integers and even symbols.
Nevertheless, symbols (i.e., identifiers) are returned as plain strings
for the time being: the class
symbol::Symbol
is introduced in T1.