The easiest way to write an analyzer specification file for Tatoo is to use the new Tatoo ebnf file format. An eclipse plugin for these file is available.
Throught the writing of a specification file one can:
The ebnf file is a made of sections which consist of the line
name:
followed by its content. The valid sections
are:
tokens
and blanks
where the lexical part is
givenstarts
, error
, versions
and
productions
which describe the grammarFrom the content of the ebnf file, Tatoo generates a lexer, a parser or both.
Though the generated lexer and parser can be used directly (which is advised if the analyzer is used in a small device), the glue between them, semantic stack managment or AST generation can be generated using the tools module of Tatoo. Its specification is given with an XML file or putting types in the ebnf file (the latter is dicouraged since it prevents clean separation between semantic and syntax).
The tools XML file consists in three kinds of directives:
rule
which links a lexer rule (regular expression)
to a terminal; these directives are usually not needed with the ebnf
format. They can also specify which rules bypass the rule selection
system (this is the case by default for blanks) or rules that are only
part of a token (for instance strings or comments)terminal
gives the type of terminal attributes
(which is void by default);non-terminal
gives the type of non-terminal
attributes (which is also void by default).