parsing - What are these odd errors that occur when I attempt to generate C# with ANTLR4? -
i'm (now) trying use antlr4 , c# design language, , far i've been fiddling around it. in process, decided try , create simple mathematical expression evaluator. in process, created following antlr grammar it:
grammar calculator; @parser::members { protected const int eof = eof; } @lexer::members { protected const int eof = eof; protected const int hidden = hidden; } program : expr+ ; expr : expr op=('*' | '/') expr | expr op=('+' | '-') expr | int | '(' expression ')' ; int : [0-9]+ ; mul : '*' ; div : '/' ; add : '+' ; sub : '-' ; ws : (' ' | '\r' | '\n') -> channel(hidden) ;
when try generate c# code using command:
java -jar c:\...\antlr-4.2-complete.jar -dlanguage=csharp .\...\grammar.g4
i these odd errors:
error(50): c:\users\ethan\documents\visual studio 2015\projects\cypresslang\cypresslang\source\.\grammar\cypressgrammar.g4:1:0: syntax error: 'ï' came complete surprise me error(50): c:\users\ethan\documents\visual studio 2015\projects\cypresslang\cypresslang\source\.\grammar\cypressgrammar.g4:1:1: syntax error: '»' came complete surprise me error(50): c:\users\ethan\documents\visual studio 2015\projects\cypresslang\cypresslang\source\.\grammar\cypressgrammar.g4:1:2: syntax error: '¿' came complete surprise me error(50): c:\users\ethan\documents\visual studio 2015\projects\cypresslang\cypresslang\source\.\grammar\cypressgrammar.g4:1:3: syntax error: mismatched input 'grammar' expecting semi
what might causing these errors, , how can fix them? best guess @ moment visual studio inserting odd characters onto beginning of file, , can't remove them.
today not day.
visual studio decided mess me , change file formats utf-8 of files. needed go file > advanced save settings
, , change encoding us-ascii. removed odd characters inserted @ beginning, , solved (most) of problems.
Comments
Post a Comment