Use LL1Analizer in a javascript target

15 views
Skip to first unread message

Karima Rafes

unread,
May 15, 2018, 11:56:03 AM5/15/18
to antlr-discussion
Hello

I found this doc :

And, I generated a parser with ANTLR4 and I can catch syntax errors.

But I didn't found  examples about the way to use LL1Analizer with Javascript. I want to implement a simple code completion.

You know if an example exists  (or a doc) ?

Thanks
Karima

Mike Lischke

unread,
May 16, 2018, 3:16:41 AM5/16/18
to antlr-di...@googlegroups.com
>
> I found this doc :
> https://github.com/antlr/antlr4/blob/master/doc/javascript-target.md
>
> And, I generated a parser with ANTLR4 and I can catch syntax errors.
>
> But I didn't found examples about the way to use LL1Analizer with Javascript. I want to implement a simple code completion.

The LL1Analyzer is mostly used for error messages to provide a list of expected tokens. Just check the call history to see where this class is used in the ANTLR4 runtime, it’s pretty simple.

>
> You know if an example exists (or a doc) ?

There’s no other example or doc I know of as this class is only a pretty simple ATN walk within a single rule (which makes it not very well suited for code completion). Instead you might be interested in this project: https://github.com/mike-lischke/antlr4-c3 (which is written in Typescript - Java, Kotlin and C++ ports exist too).

Mike
--
www.soft-gems.net

Reply all
Reply to author
Forward
0 new messages