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

Create an example of how to parse an indentation sensitive grammar. #16

Open
DamianReeves opened this issue Jan 23, 2021 · 2 comments
Open

Comments

@DamianReeves
Copy link

I just bumped across Farkle while looking for resources on parsing indentation sensitive grammar using FParsec. The library/tooling looks intriguing, but it would be great if some guidance/examples on how to support offsides like F#, Elm, or Python.

For reference the language I am trying to create a parser for is Elm.

@teo-tsirpanis
Copy link
Owner

Hello and thanks for using Farkle.

Writing indentation-based grammars can be done using virtual terminals together with a custom tokenizer. This is somewhat complicated but there is a sample indent-based grammar built on these features.

This feature will be available when Farkle 6.0 is released. Until then, you can try the alpha versions from Farkle's CI NuGet feed at https://ci.appveyor.com/nuget/farkle.


Having a more succinct API for indent-based grammars within Farkle would be a good idea with a valid use case. I have some ideas in my mind but I would love to hear your feedback.

@DamianReeves
Copy link
Author

Writing indentation-based grammars can be done using virtual terminals together with a custom tokenizer. This is somewhat complicated but there is a sample indent-based grammar built on these features.

Awesome, I'll look at the sample.

Like, i said, I'm looking to write an Elm parser so the Elm language syntax is my example. I'm going to try hacking on this using Farkle.

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

No branches or pull requests

2 participants