diff options
Diffstat (limited to 'src/include/parser.hpp')
-rw-r--r-- | src/include/parser.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/parser.hpp b/src/include/parser.hpp new file mode 100644 index 0000000..7bc7997 --- /dev/null +++ b/src/include/parser.hpp @@ -0,0 +1,24 @@ +/* Grammar + * Expression --> Term PrimeExpression + * PrimeExpression --> (+|-)Expression | Null + * Term --> Factor PrimeTerm + * PrimeTerm --> (*|/)Term | Null + * Factor --> -Expression | (Expression) | operand */ +#pragma once +#include "tokenizer.hpp" +#include "syntax_tree.hpp" + + +class Parser { +private: + // Private methods. + void parseExpression(); + void parsePrimeExpression(); + void parseTerm(); + void parsePrimeTerm(); + void parseFactor(); + // End of private methods. +public: + Parser(); + const SyntaxTree *parse(); +}; |