Getting Started JavaSCrpit

49 views
Skip to first unread message

salvador.r...@gmail.com

unread,
Mar 14, 2016, 2:18:53 PM3/14/16
to antlr-discussion

well, I have some doubts about getting started on ANTLR4 in JavaScript. I am already able to generate the necessary files but I don´t know what to do with them.

I tried to follow the JavaScript target tutorial in the documentation and didn't understand the part of "How getting the run time in my browser" as a result I ended up with this doubts:

  1. I don't know where to include all the files that antlr4 generated in a JavaScript project.

  2. I had already used Flex/Bison for some projects I did on C++ and I was able to use it but with JavaScript Antlr4 seems confuse when I tried to do some samples.For example; I already created my grammar file called "hello.g4" and when I use the "antlr4" command I previously set up, it gives me the next files:


  3. so, here is where the problems comes, because I really want to do so with it, I mean, in an Html file with a text box inside, I want to make the input from that text box trigger a JavaScript function which recognize the pattern written in the grammar file called "Hello.g4".

I hope you can help me.

Best regards.

Eric Vergnaud

unread,
Mar 15, 2016, 10:07:55 AM3/15/16
to antlr-discussion
If you can read Java code (used to run the tests), you will find some working pieces of html in the antrl4 test suite.

Miroslav Lazarevic

unread,
Apr 5, 2016, 5:09:17 PM4/5/16
to antlr-discussion
Well I made a progress with JavaScript and ANTLR4 when I saw this working example https://github.com/baloodevil/antlr4-calculator-javascript. See how it is done in this example project. If you prefer using node instead of browser check this demo project https://github.com/diamondman/antlr4_javascript_demo

good luck
Reply all
Reply to author
Forward
0 new messages