Dec 23, 2016 at 10:12 AM

My grammer class:
NonTerminal sd = new NonTerminal("main");
        ConstantTerminal constTerminal = new ConstantTerminal("boolean", typeof(bool));
        constTerminal.Add("true", true);
        sd.Rule = constTerminal;
        Root = sd;
This code execute a exception:
Grammar grammar = new GridWorldGrammar1();
        LanguageData language = new LanguageData(grammar);
        Parser parser = new Parser(language);

        // This method populate the tree.
        ParseTree parseTree = parser.Parse("true");

What is the reason of the exception?
Dec 24, 2016 at 7:47 AM
what's the exception?!
Dec 24, 2016 at 9:22 AM

The result is a exception in the file AstBuilder on line 111 (il.Emit(OpCodes.Newobj, constr);) Message An unhandled exception of type 'System.ArgumentNullException' occurred in mscorlib.dll

How can i solve this?
Dec 25, 2016 at 8:37 AM
It tries to create default AST node. Do you need to create AST? if not, remove CreateAst flag from Grammar.LanguageFlags
If yes, you need AST, then assign you must provide AST node types for all Terminals and nonterminals - look at expression evaluator