mageran / node-xsyn

Extensible syntax for nodejs - under construction
0 stars 1 forks source link

Node xsyn fails to recognize non terminals which are combination of non alphabets and alphabets #2

Open nithinsag opened 8 years ago

nithinsag commented 8 years ago

eg grammar

PROGRAM : START END
            {%
console.log("Encountered a Program")
            %}              ;

START : '<--start';
END : 'end-->';

error:

D:\v8 compiler\node-xsyn>node parser.js
hello.gra -> .xsyn_gen\hello.js
compilation needed
compiling 'hello.gra' into module 'hello'...

D:\v8 compiler\node-xsyn\node_modules\node-xsyn\xsyn\js_gen\xsyn_grammar_impl_De
faultTokenStream.js:839
        throw new IllegalKeywordOrSymbol(kwOrSym);
        ^
 illegal keyword/symbol in grammar: "<--start"
mageran commented 8 years ago

Yes, this is by design. Keywords can consists either of symbols or be alphanumeric. In your example you would split your keywords in 2 separate ones. Full customizable lexical tokens will be added in future versions. Matthias

On Monday, December 14, 2015, Nithin Saji notifications@github.com wrote:

eg grammar

PROGRAM : START END {% console.log("Encountered a Program") %} ;

START : '<--start'; END : 'end-->';

error:

D:\v8 compiler\node-xsyn>node parser.js hello.gra -> .xsyn_gen\hello.js compilation needed compiling 'hello.gra' into module 'hello'...

D:\v8 compiler\node-xsyn\node_modules\node-xsyn\xsyn\js_gen\xsyn_grammar_impl_De faultTokenStream.js:839 throw new IllegalKeywordOrSymbol(kwOrSym); ^ illegal keyword/symbol in grammar: "<--start"

— Reply to this email directly or view it on GitHub https://github.com/mageran/node-xsyn/issues/2.