Semantic analysis beginning
This commit heavily focus on the implementation of SOL semantic analysis
Main changes are: 2,3,4
1) DOCUMENTATION: creates a LOT of dot used inside doxygen related
pages. This pages are meant to give to the developer a global view of
the project. Inside you can find the explanation of the syntax tree: for
every node type inside it, the page shows you what are its children.
Moreover you can find the SOL global structure in the related pages: the
page teach you how the project is organised (lex module, syntax module,
semantic module, tables). The commit also adds some *.dox explaining
when certain fileds in SchemaNode or SymbolNode are meaningful and when
they are not.
2) CONCEPT: Adds some content inside "semantic rules" file. It's all
theory but inside it there are some rules on how sem() function should
be implemented. "type" is a inherited attribute representing the type to
carried through the semantic tree. "currentOperation" (cop) is a
variable indicating what is the semantic meaning of a particular syntax
node: it is necessary within syntactical nodes present in different
scenarios: for example a decl is present both in type declaration and
function declaration; there must be something which divides scenario
from scenario: this something is "cop". The GREAT challenge is make sure
that semantic analysis does not only track errors but also update both
SymbolTable and SchemaTable.
3) LEXICAL: finds and solves a bug on id: before this ids can't accept
"_" tokens. Solves bug on +/-: before that, parser cannot properly
detect "a+3" and "a-3"; now it is solved: lex detects only int/real
constants (without sign) and signs separately; the parser use the node
UMINUS to effectively adds sign to number. Adds the use of the
lexicalTavble inside lex: now if equal ids are stored only once (so if
in the source code there is a lot of "qwerty" ids/string constant the
string "qwerty" is present in memory only ONCE. How? we use an hashTable
called lexicalTable which take care of storing, adding the ids. The
table can be then totally freed using freeLexicalTable();
4) SYNTAX: we now use a precedence table while heandling "expr"
derivation rules instead of using a lot of sub derivation rules like
"rel_term", "high_bin_op" ex cetera. Note the use of UMINUS to handle
phrases like "a+3" "a-3".
5) UTILS: since initQuotedString and initString are no longer used, the
header should be renamed into "hash.h": this because now it contains
only hash functions.