private static void StatementList() { Grammar.Add(new GrammarReplaceRule(TokenEnum.StatementList, new CompositeToken { TokenEnum.StatementList, TokenEnum.NewLine(), TokenEnum.Statement })); Grammar.Add(new GrammarReplaceRule(TokenEnum.StatementList, new CompositeToken { TokenEnum.NewLine(), TokenEnum.Statement })); Grammar.Add(new GrammarReplaceRule(TokenEnum.Statement, new CompositeToken { TokenEnum.UnlabeledStatement })); Grammar.Add(new GrammarReplaceRule(TokenEnum.Statement, new CompositeToken { TokenEnum.Label(), TokenEnum.String(":"), TokenEnum.UnlabeledStatement })); Grammar.Add(new GrammarReplaceRule(TokenEnum.StatementList1, new CompositeToken { TokenEnum.StatementList, TokenEnum.NewLine() })); }
private static void If() { Grammar.Add(new GrammarReplaceRule(TokenEnum.UnlabeledStatement, new CompositeToken { TokenEnum.String("if"), TokenEnum.LogicalExpression1, TokenEnum.String("then"), TokenEnum.String("goto"), TokenEnum.Label() })); }