MysoreScript
parser.hh
Go to the documentation of this file.
1 #include "grammar.hh"
2 #include "ast.hh"
3 
4 namespace Parser
5 {
10  class MysoreScriptParser : public pegmatite::ASTParserDelegate
11  {
12 #define CONNECT(cls, r) BindAST<AST::cls> r = MysoreScriptGrammar::get().r
13  CONNECT(Number, num);
14  CONNECT(Multiply, mul_op);
15  CONNECT(Divide, div_op);
16  CONNECT(Add, add_op);
17  CONNECT(Subtract, sub_op);
18  CONNECT(CmpNe, ne_cmp);
19  CONNECT(CmpEq, eq_cmp);
20  CONNECT(CmpLt, lt_cmp);
21  CONNECT(CmpGt, gt_cmp);
22  CONNECT(CmpLE, le_cmp);
23  CONNECT(CmpGE, ge_cmp);
24  CONNECT(StringLiteral, string_body);
25  CONNECT(Identifier, identifier);
26  CONNECT(ArgList, callArgList);
27  CONNECT(ParamList, argList);
28  CONNECT(ClosureDecl, closure);
29  CONNECT(VarRef, variable);
30  CONNECT(Assignment, assignment);
31  CONNECT(Call, call);
32  CONNECT(Decl, decl);
33  CONNECT(Return, ret);
34  CONNECT(IfStatement, ifStatement);
35  CONNECT(WhileLoop, whileLoop);
36  CONNECT(Statements, statements);
37  CONNECT(ClassDecl, cls);
38  CONNECT(NewExpr, newExpr);
39 #undef CONNECT
40  public:
45  };
46 }
Class representing a parser for the MysoreScript language.
Definition: parser.hh:10
static const MysoreScriptGrammar & get()
Returns a singleton instance of this grammar.
Definition: grammar.hh:220
Definition: parser.hh:4
Grammar for the MysoreScript language.
Definition: grammar.hh:16
const MysoreScriptGrammar & g
The grammar that this parser uses.
Definition: parser.hh:44