Thanks Ben, you understood me correctly.

Your tool loner parses a dialect of EBNF and gives me the parse tree of 
that EBNF grammar file in a scala representation, as I see at your demo page 
<https://benknoble.github.io/loner/demo.html>. That is exactly what I need 
– however, instaparse has a slightly different dialect of EBNF.

I was hoping that the instaparse parser internally holds the EBNF 
representation but I don't know how I can see or check that. Maybe your 
guess is right and it throws away the parse tree... I probably have to look 
into the source code of instaparse... Or I transform our EBNF to match your 
specification and use loner...

ben.k...@gmail.com schrieb am Sonntag, 18. Juli 2021 um 02:50:48 UTC+2:

> I haven't touched Clojure in a year or two, and I'm not familiar with 
> instaparse.
>
> I can say, from a terminology stand-point, that a grammar (such as one in 
> EBNF) can produce a parser, which then produces parse-trees of input 
> strings. So, perhaps you mean that you want parse-trees of strings in the 
> grammar of EBNF? It took me a few reads to come to this conclusion—the 
> expression "get a parse tree of the EBNF" threw me off.
>
> It seems likely that instaparse is producing a parser, and may throw away 
> the underlying graph (parse-tree) of the grammar.
>
> Regardless, I have a Scala tool that parses EBNF. I'm not sure about 
> interop, but it's all JVM, right? https://github.com/benknoble/loner
>
> On Saturday, July 17, 2021 at 3:21:36 PM UTC-4 jsch...@gmail.com wrote:
>
>>
>> Hi all,
>>
>> I was hoping that I can call
>>
>> (instaparse.core/parser "my ::= 'ebnf' | 'grammar' ")
>>
>> to get a parse tree of the EBNF. I'd like to convert the EBNF to a 
>> tree-sitter grammar.js.
>>
>> But when I evaluate the above expression, I only see a the original EBNF 
>> input, reformatted, and without comments:
>>
>> => my = "ebnf" | "grammar"
>>
>> Is there a way to get hands on the underlying structure, i.e. the parse 
>> tree?
>>
>> Best, Jakob
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/603726f0-ed7a-4de3-b7f2-83a8effe23b6n%40googlegroups.com.

Reply via email to