Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where do I get grammars :P #435

Closed
ShalokShalom opened this issue Feb 7, 2023 · 7 comments
Closed

Where do I get grammars :P #435

ShalokShalom opened this issue Feb 7, 2023 · 7 comments
Labels
faq User question

Comments

@ShalokShalom
Copy link

Hi there 👍🏻

I look for a FSharp ANTLR implementation.
Your project seems to be promising, considering that it outouts ANTLR, and I also read that you have an OCaml backend.

I probably miss something, because I know about a treesitter and an ANTLR grammar repository. And there seems to be no such thing for LBNF, BNF, ABNF or EBNF.

I understand that you only parse from LBNF, but J haven't found a grammar collection of existing languages at all.

Do you know, where I can get a F# xBNF grammar, or alternatively one from OCaml?

Thanks a lot ☀️

@andreasabel andreasabel added the faq User question label Feb 8, 2023
@andreasabel
Copy link
Member

Do you know, where I can get a F# xBNF grammar, or alternatively one from OCaml?

Sorry, I don't know anything off the top of my head, but I leave this issue open for a while so folks can chime in.
If you find something, please let us know.

@ShalokShalom
Copy link
Author

ShalokShalom commented Feb 9, 2023

Well, I found a couple, and all of them were about a different implementation.
How compatible is BNFC with BNF, EBNF and others? How much is the labeling required?

That list is huge and out of date since 2015: https://slebok.github.io/zoo/index.html
And here is a list from EBNF files, that got translated from treesitter. https://github.com/mingodad/plgh

@andreasabel
Copy link
Member

andreasabel commented Feb 9, 2023

In labelled BNF (BNFC), each rule needs a distinct label. It does not cover all of EBNF, which also has * for lists etc. (and ? and +).

@ShalokShalom
Copy link
Author

Aha. So I wont be able to convert EBNF files properly. But partly? Your website doesnt make this clear. Lots of BNF files are out there, and you dont seem to know about a lot of grammars for LBNF.

Does it seem to make sense, that full compatibility could raise the usefulness of this tool since we could produce a lot of grammars?

In terms of backends and overall maintenance seems this project to be one of the leading figures. 😄

@andreasabel
Copy link
Member

BNFC's concept is to be a common front-end to YACC-like parser generators in different languages. So we are just serving the common feature set.

There are feature requests, though, that ask for an extension of the LBNF formalism, e.g. for ?:

@ShalokShalom
Copy link
Author

Ok? I didnt know you are supporting Yacc either?

I am looking for a Yacc translator.

Can you help me to translate the FSharp grammar?

https://github.com/dotnet/fsharp/blob/main/src/Compiler/pars.fsy
https://github.com/dotnet/fsharp/blob/main/src/Compiler/pppars.fsy

@andreasabel
Copy link
Member

Can you help me to translate the FSharp grammar?

FSharp uses layout, so this does not fit into pure BNF or LBNF: https://fsharpforfunandprofit.com/posts/fsharp-syntax/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq User question
Projects
None yet
Development

No branches or pull requests

2 participants