Simple getting-started questions #4712
Replies: 5 comments 4 replies
-
To change the output on error, remove all listeners and add your listener. In your listener code, do what you need to do to change how it looks or where to output. For your tree walker, you don't need to use any of the generated listener or visitor classes that are generated, or the tree walker or visitor code. You can write your own tree walker code. Or, you can use a higher-level tree pattern matcher using XPath in Antlr, or external. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help! Just FYI, chatGPT gives really good examples! |
Beta Was this translation helpful? Give feedback.
-
I was just going to say the same. Much better results. The new canvas stuff may do even better but I have tested itOn Oct 4, 2024, at 11:08, Blake McBride ***@***.***> wrote:
I've found the new 01 model incredible and quite a bit smarter than the old 4o model.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I think it still does not scrape URls Ken. But the canvas stuff is supposed to do that I think. On Oct 4, 2024, at 11:57, Ken Domino ***@***.***> wrote:
Here is an update to the question "Please scrape the EBNF at https://flang.llvm.org/docs/f2018-grammar.html. Please give the complete grammar." with the new LLM. https://chatgpt.com/share/67001b53-6450-8007-9516-b1655b9d7c7f. It still does not give the complete answer.
When I ask to give the definition for "rename-list", it gives that correctly (rename-list ::= rename { , rename }), but defines "rename" incorrectly, when it could have just left it there, or given the EBNF of the rule as something like rename ::= local-name => use-name | OPERATOR ( local-defined-operator ) => OPERATOR ( use-defined-operator ). Imstead. ot follows up with all sorts of BS with regards to "use-name", completely irrelevant.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I can’t really think of making it much higher level to be honest. There are options and so on at the lexer level and parser level. I think trying to treat the lever and parser as one will lead to more confusion about the order of operation than we already get. Parsing is fundamentally not the trivial problem it seems to be when you want can efficient parser. We would do better to spend time on better documents about performance analysis and ambiguities. Th ease questions come up very often and by that time people have assembled a bunch of random rules without understanding such things. I’d even go so far as to say that the default options and reporting should print all tracing etc and you get to turn them off rather than on. Upgrading would require a change or we could maybe deprecate existing methods and document new ones for new people. Just done random thoughtsJimOn Oct 4, 2024, at 11:18, Blake McBride ***@***.***> wrote:
Incidentally, while working with the latest ANTLR, I've come to the following opinion. ANTLR provides a very powerful and functional toolkit. However, a higher-level API is sorely needed (without getting rid of the toolkit API). A great deal of, effectively, boiler-plate code could be combined to make this higher-level API. It would make ANTLR far, far easier to use.
Some examples:
Why treat the lexer and parser as two different entities throughout when they're interrelated. Tread them as a unit.
Except for testing, why would anyone want errors printed to the console? Put them in a linked list and then provide a simple utility to dump them to the console when testing rather than the other way around.
Many, many more instances of stuff like this. You could easily create a high-level API that would make using ANTLR trivial rather than a pretty complex project.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Greetings,
Although I've known of ANTLR since the C days, I've never used it before. I've built lots of parsers by hand in the interim. This time, I'm hoping not to work so hard.
I wrote a grammar that seems to work. I am running it as follows:
Here is what I need:
The above code appears to print to the console syntax errors (before the println). I'd rather catch an exception or check a return (along with an error string) to handle it myself. How can I do that?
I think I'd rather traverse the tree rather than using callbacks. Is that a bad idea? How can I do that?
Thanks!
Blake McBride
Beta Was this translation helpful? Give feedback.
All reactions