antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.21k stars 3.29k forks source link

Display parse tree visually in web browser #2658

Open xiaoiver opened 5 years ago

xiaoiver commented 5 years ago

I'm working on a web SQL editor and I need to display the parse tree frequently when writing SQL formmating rules. So I wrote a simple tool for displaying parse tree visually in web browser just like Antlr grun. Here's the online demo and repo. image

ericvergnaud commented 5 years ago

I love this! Some time ago, I was hoping we could provide ANTLR tools online, using ACE to edit the .g4, antlr to generate the parsers, and this kind of rendering. @parrt if the antlr budget can afford a low-end EC2 box, I’m happy to make this happen with the help of kind contributors

Le 29 sept. 2019 à 11:57, xiaoiver notifications@github.com a écrit :

I'm working on a web SQL editor and I need to display the parse tree frequently when writing SQL formmating rules. So I wrote a simple tool for displaying parse tree visually in web browser just like Antlr grun. Here's the online demo https://xiaoiver.github.io/antlr-grun-web/ and repo https://github.com/xiaoiver/antlr-grun-web. https://user-images.githubusercontent.com/3608471/65825914-51245300-e2af-11e9-9dac-420d341212c3.png — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/antlr/antlr4/issues/2658?email_source=notifications&email_token=AAZNQJHXVU5MOPMLZNL4NY3QMARRFA5CNFSM4I3QVHR2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HOLE5QA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZNQJACKRIG7T2P3QJC6TDQMARRFANCNFSM4I3QVHRQ.

KvanTTT commented 5 years ago

Possible it should look like https://astexplorer.net/ but with custom grammars. I also like such idea.

parrt commented 5 years ago

hi guys!! looks cool, but how is this different than just using the intellij plugin, for example? Also I'm not sure spending whatever it is, $150/yr + network charges, is worth it for a few users. Once it's up, people would howl if I got tired of paying the fees. Why not just provide a simple tool that is the same combined html5 webpage and local server so people can run locally? faster and costs nothing for anybody?

ericvergnaud commented 5 years ago

IntelliJ is a tool for Java developers primarily. Downloading a tool or a VM is indeed an alternative. I guess a pure web tool would help spread antlr faster. There is a -tiny- possibility that this can be achieved using server less, which would then bring the fees to almost nothing. Or the server could be sponsored by a cloud vendor? Or the community?

parrt commented 5 years ago

I guess the real question is: are we in a situation where people cannot easily show parse trees? To run antlr people need a java vm installed and grun works. It just doesn't have an "interface". Wouldn't a trivial python program with tkinter be enough to pop up a dialog box to select grammar and input then run grun vs os.exec?

ericvergnaud commented 5 years ago

If it were, would xiaoiver have done what he did, and would we be having this discussion ? Today’s UI is the browser.

parrt commented 5 years ago

Well one person doesn’t move me much. People do all sorts of random shit for fun or other reasons. Story of my life ;). I've only had this request a few times so I'm not sure how urgent it is. Regardless, you guys are free to do whatever you like and I’m happy to support with a dns link to whatever server you want. Just lemme know. Maybe I can make DNS grun.antlr.org point to some REST service on-demand somewhere? (As long as I'm not involved...too involved elsewhere)