0
b.a := 7;
내 문법과 같은 문을 구문 분석 문법을 쓰기 위해 노력하고 있어요 그것은 내가
을 구문 분석하려고 할 때 잘 작동public class STGrammar : InterpretedLanguageGrammar
{
public STGrammar() : base(caseSensitive: false)
{
LanguageFlags = LanguageFlags.CreateAst;
# region Terminals
Terminal n = new NumberLiteral("number");
Terminal v = new IdentifierTerminal("variable");
KeyTerm assignment = ToTerm(":=");
KeyTerm left_paren = ToTerm("(");
KeyTerm right_paren = ToTerm(")");
KeyTerm terminate = ToTerm(";");
KeyTerm left_sq = ToTerm("[");
KeyTerm right_sq = ToTerm("]");
KeyTerm dot = ToTerm(".");
#endregion Terminals
#region Nonterminals
NonTerminal actionBlock = new NonTerminal("actionBlock", typeof(ActionBlock));
NonTerminal assignmentExpr = new NonTerminal("assignmentExpr", typeof(AssignmentStNode));
NonTerminal arrayOrStruct = new NonTerminal("arrayOrStruct", typeof(ArrayNode));
NonTerminal arrayOrStructRHS = new NonTerminal("arrayOrStructRHS", typeof(AstNode));
NonTerminal arrayOrStructRHSs = new NonTerminal("arrayOrStructRHSs");
NonTerminal comparatorExp = new NonTerminal("comparatorExpression", typeof(ExpressionNode));
#endregion Nonterminals
#region BNFRules
actionBlock.Rule =
assignmentExpr + terminate
| arrayOrStruct + terminate
;
assignmentExpr.Rule =
v + assignment + v
| v + assignment + n
| arrayOrStruct + assignment + v
| v + assignment + arrayOrStruct
| arrayOrStruct + assignment + arrayOrStruct
| arrayOrStruct + assignment + n
;
arrayOrStruct.Rule =
v + arrayOrStructRHSs
;
arrayOrStructRHS.Rule =
"." + v
| "[" + v + "]"
;
arrayOrStructRHSs.Rule =
MakePlusRule(arrayOrStructRHSs, arrayOrStructRHS)
;
this.Root = actionBlock;
#endregion BNFRules
MarkPunctuation(",", ";", "[", "]", ")", "(", "..", ".");
RegisterBracePair("(", ")");
}
}
아래와 같습니다
b := 7;
올 오류는 Fatal Error in code colorizer. Colorizing had been disabled.
입니다. 댓글을 달았을지라도
LanguageFlags = LanguageFlags.CreateAst;
오류가 계속 발생합니다. 자세한 오류가
System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
Source=Irony
StackTrace:
at Irony.Ast.AstBuilder.BuildAst(ParseTreeNode parseNode) in C:\Sreeja\downloads\Irony_2013_03_10\Irony\Ast\AstBuilder.cs:line 97
at Irony.Ast.AstBuilder.BuildAst(ParseTreeNode parseNode) in C:\Sreeja\downloads\Irony_2013_03_10\Irony\Ast\AstBuilder.cs:line 86
at Irony.Ast.AstBuilder.BuildAst(ParseTreeNode parseNode) in C:\Sreeja\downloads\Irony_2013_03_10\Irony\Ast\AstBuilder.cs:line 86
at Irony.Ast.AstBuilder.BuildAst(ParseTreeNode parseNode) in C:\Sreeja\downloads\Irony_2013_03_10\Irony\Ast\AstBuilder.cs:line 86
at Irony.Ast.AstBuilder.BuildAst(ParseTree parseTree) in C:\Sreeja\downloads\Irony_2013_03_10\Irony\Ast\AstBuilder.cs:line 38
at Irony.Interpreter.InterpretedLanguageGrammar.BuildAst(LanguageData language, ParseTree parseTree) in C:\Sreeja\downloads\Irony_2013_03_10\Irony.Interpreter\InterpretedLanguageGrammar.cs:line 60
at Irony.Parsing.Parser.Parse(String sourceText, String fileName) in C:\Sreeja\downloads\Irony_2013_03_10\Irony\Parsing\Parser\Parser.cs:line 88
at Irony.GrammarExplorer.fmGrammarExplorer.ParseSample() in C:\Sreeja\downloads\Irony_2013_03_10\Irony.GrammarExplorer\fmGrammarExplorer.cs:line 348
at Irony.GrammarExplorer.fmGrammarExplorer.btnParse_Click(Object sender, EventArgs e) in C:\Sreeja\downloads\Irony_2013_03_10\Irony.GrammarExplorer\fmGrammarExplorer.cs:line 507
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
누군가가 나에게 오류를 해결하는 데 도움이 수
입니까? Irony_2013_03_10 버전을 사용하고 있습니다.