javascript - Antlr4/JS - what to put in the html file ? (pb following the tuto) -
i'm following example in page js target: installed require.js , antrl4 runtime on test site, compiled grammar explained, prepared small html file mimicking tuto. (fixing missing after ).
for grammar, i'm using variant of expr.g4 of book. fixed bug in it, extended doubles, adapted actions js.
now, i'm puzzled 2 things in html.
- the js evalution stops at var lexer = new grammarlexer.grammarlexer(chars); . js console don't show function being called. btw don't understand how guess function in file grammarlexer.ls . isn't there require or file declaration missing here ?
- the tuto should write visitor or listener, no guidance poor people accustomed antrl2 am. have js actions in grammar, isn't sufficient in case ? (may "your grammar comprises production code" means that).
( btw if have syntax error in js actions, js console show despites asynchronous calls ?)
but first, let unstuck point 1 :-)
thanks !
ok, in tuto key information missing: need first var grammarlexer =require('grammarlexer'), grammarparser =require('grammarparser'); (how javascript not protest on new grammarlexer.grammarlexer() class being undefined ???)
now it's function call parser.startrule() never return - without console message. ideas ?
Comments
Post a Comment