Replies: 12 comments 15 replies
-
There were a few comments about supporting other targets and even action code in the long discussion last year, e.g. interp simulator for Javascript and even antlr4ts. For now, it would be best for the interp itself to output a warming if an action is encountered. |
Beta Was this translation helpful? Give feedback.
-
The lab runs on server side in Java, running parsers in a lambda could be a solution to prevent damage |
Beta Was this translation helpful? Give feedback.
-
Also to consider, there's only a syntaxError() as output from the parser. No such thing as a warning. Seems rather limited to what most compilers do. I suppose the interpreter not being able to execute an action is pretty much a failure though. What should happen if the parse doesn't actually need to execute the action from a particular start rule? No need to produce a warning even if the grammar does have actions. |
Beta Was this translation helpful? Give feedback.
-
I'd be comfortable not executing actions because the lab is about parsing, not about further steps. But predicates participate in parsing so it's certainly worth a discussion. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I use "actions" to be either
|
Beta Was this translation helpful? Give feedback.
-
A solution worth exploring would be to generate the lexer and parser in JavaScript on the server, and run them in the browser. This would require devs to code predicates in JS (in the lab) but that sounds like a reasonable requirement |
Beta Was this translation helpful? Give feedback.
-
Most if not all grammars in grammars-v4 that have a JS port are in "target agnostic format", which means there are addition source files in JS. It would be nice to have the tool have an extra tab for these files. Otherwise, we'd need to refactor the grammars on the fly to use |
Beta Was this translation helpful? Give feedback.
-
Maybe we should convert this into a discussion? |
Beta Was this translation helpful? Give feedback.
-
Yes, please do. Also of note. There is no consistent "recognizer base class method reference" syntax across targets. So we have action code with:
(I haven't set up testing for Swift because of the lack of a Mac machine--currently a brick, can't install a new OS on a blank HDD.) The grammars contain either |
Beta Was this translation helpful? Give feedback.
-
I think the server runs the grammars via the Java-based interpreter so it's not compiling/executing random code from the internet. One infinite loop and server is dead ;) |
Beta Was this translation helpful? Give feedback.
-
@parrt running it in a lambda would eliminate that risk entirely, since a lambda cannot run for more than 15 mns (AWS, not sure about GCP). |
Beta Was this translation helpful? Give feedback.
-
Macros would be confusing as C++ already has a preprocessor in the language, and presumably one can embed macros in |
Beta Was this translation helpful? Give feedback.
-
As noted here, the javadoc/ grammar contains actions. lab.antlr.org should output a warning message if the grammar contains action code since action code will not be executed. Even long-time users of Antlr will make an assumption that is wrong.
Beta Was this translation helpful? Give feedback.
All reactions