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

add Fable support to FsLexYacc.Runtime #203

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

dawedawe
Copy link
Member

@dawedawe dawedawe commented Apr 7, 2024

This allows easy usage of FsLexYacc-generated lexers/parsers with Fable.

let unicodeCategory = System.Globalization.CharUnicodeInfo.GetUnicodeCategory(inp)

let unicodeCategory =
#if FABLE_COMPILER
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that these can differ, see Remarks here
But in practice, I think it's acceptable.

@nojaf
Copy link
Collaborator

nojaf commented Apr 8, 2024

I'm a little confused what this does.
Does it allow you to consume the generated pars.fs and lex.fs?
Or are you generating those file with Fable?
In what language did this work for you?

@dawedawe
Copy link
Member Author

dawedawe commented Apr 8, 2024

Does it allow you to consume the generated pars.fs and lex.fs?

Yes, with this PR I can

  • copy the generated Lexer/Parser to a fable project
  • add the new FsLexYacc.Runtime package to it
  • compile to Javascript and use the parser in the browser (or locally with bun, of course).

No need for WASM or a full fledged .NET backend just to parse sources and give feedback to the user.

Would be really, really helpful for me to have this.

Copy link
Collaborator

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm ok with having this, thanks 🤘!
(Would be cool to have a branch in https://github.com/dawedawe/agentleintroductiontofslexyacc showcasing this.)

@nojaf nojaf merged commit 3e31ff5 into fsprojects:master Apr 8, 2024
3 checks passed
@dawedawe
Copy link
Member Author

dawedawe commented Apr 8, 2024

Thanks!
A new release is all I need for the showcase.

@dawedawe
Copy link
Member Author

Yeah, I'm ok with having this, thanks 🤘! (Would be cool to have a branch in https://github.com/dawedawe/agentleintroductiontofslexyacc showcasing this.)

image

I added a new project to showcase in the browser: https://github.com/dawedawe/agentleintroductiontofslexyacc/tree/main/src/AfLang.Js

@dawedawe dawedawe deleted the add_fable_support branch April 12, 2024 10:39
@dawedawe dawedawe restored the add_fable_support branch April 23, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants