diff options
author | HombreLaser <buran@silosneeded.com> | 2024-06-22 16:45:04 -0600 |
---|---|---|
committer | HombreLaser <buran@silosneeded.com> | 2024-06-22 16:45:04 -0600 |
commit | 404826e78a56e15e20d3938aed80945295921745 (patch) | |
tree | d607769fccfc4e3c77a9465a9800004421c500cb /src/include/parser.hpp | |
parent | 10ecf4d95194a273cc6aab89c3a1bcf739a194cd (diff) |
Add parser
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(); +}; |