Closed thelink2012 closed 6 years ago
Tests for syntax are not declaring variables.
This will cause problems when we introduce semantic validation.
To fix this we'll need to (at some point) print random trash to stdout whenever a undeclared variable is used. This way we can track those "wrong" tests and fix them.
When this is done look at the bottom of parser.cpp
to verify (and test) if the grammar challenges were accomplished.
With the last commit only the tests remain ^~^.
~Will not include tests for complete programs in sintatico
, will leave that for semantico
tests.~
This is a tracking issue for the progress of syntax analysis.
A small guide for adding a syntactic feature is as follow:
parser.cpp
.ast.hpp
.semantics.cpp
.ast-dump.cpp
.test/sintatico/
. Think about corner cases as well as successful ones.Do not consider semantic analysis yet, let's focus on syntax.
To run the analyses manually, taking a source file as input and giving an AST dump as output, run
./sintatico <input> <output>
.Syntax Analysis Progress
Productions which are related to each other are grouped together.
Basic Program Structure
Variable Declaration
Function Declaration
Selection Statement
Iteration Statement
Return Statement
Expression Statement
Expressions
Variable
Function Call