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

Invite you to try FslexFsyacc #156

Open
xp44mm opened this issue Dec 22, 2021 · 7 comments
Open

Invite you to try FslexFsyacc #156

xp44mm opened this issue Dec 22, 2021 · 7 comments

Comments

@xp44mm
Copy link
Contributor

xp44mm commented Dec 22, 2021

Lex/Yacc programming enthusiasts, I am very pleased to invite you to try a new series of lex/yacc tools.

Fslex is a code generator that uses regular expression syntax as a rule to generate a function, which divides the input token sequence into groups at a higher level. The Fslex is often used to remove redundant delimiters, add omitted delimiters or other syntax components, and so on. The Fslex is also used to determine context somewhere in the stream.

Fsyacc is a code generator that use BNF productions and precedences as a rule to generate a function, which resolves the input token sequence to an abstract syntax tree.

Why use this package?

  • You can use your existing handwriting tokenizer.

  • This package uses standard lex/yacc syntax to minimize your learning costs.

  • fslex/fsyacc generates respectively an independent, side-effect-free function that can be called flexibly.

  • The method of generating code is simple, without command lines and without the need to configure projects.

  • The result code is data-driven and highly readable.

  • Flexiblely compose of tokenize, regular expressions, BNF technology.

You can check it by following the link: https://github.com/xp44mm/FslexFsyacc

@dsyme
Copy link
Contributor

dsyme commented Jan 4, 2022

Cool!

One thing - could you please choose other names besides "Fslex" and "Fsyacc"? They will be too confusing to people given the tools in this repo use these names

@xp44mm
Copy link
Contributor Author

xp44mm commented Jan 5, 2022

I was very excited to have a big god to see this project. You are my idol and mentor. Whatever the name of the project is, it is F#'s descendant. Without F#, there would be no it.

@dsyme
Copy link
Contributor

dsyme commented Jan 24, 2022

@xp44mm Thank you for your kind words :)

Yes, please do choose another name. Perhaps FsLexYaccPlus or FsLexYaccAlt or just some entirely new name

@xp44mm
Copy link
Contributor Author

xp44mm commented Feb 16, 2022

@dsyme The rename of this package is easy to handle. It is okay to rename as you suggest. However there still is no shortage of name resources on nuget, and once the name is registered, it will always exist, so we use this name temporarily and will rename it at an appropriate time in the future.

I implemented an html parser and a json parser, both using fslexfsyacc, which is more readable than a hand-written automaton. Especially in html parsers, fslex is used multiplely to simplify the parsing process. Please take a review it in your busy schedule. It may surprise you.

@xp44mm
Copy link
Contributor Author

xp44mm commented Feb 25, 2022

ESTreeParser

This package is A Parser for AST Descriptor Syntax of estree. It is uploaded to nuguet.

Feature

  • Use BNF to describe AST Descriptor Syntax of estree.
    The details see to yacc file.

  • Extract all of type definitions from a md file.
    The usages see to test file.
    Some exacted definition files in codes folder.

  • Parse the type definition to AST of AST Descriptor Syntax of estree.
    The AST definitions see to code file.
    The usages see to test file.

  • Serialize AST structure instance to JSON.
    The usages see to test file.
    Some serialized JSON files in jsons folder.

@dsyme
Copy link
Contributor

dsyme commented Mar 28, 2022

I implemented an html parser and a json parser, both using fslexfsyacc, which is more readable than a hand-written automaton. Especially in html parsers, fslex is used multiplely to simplify the parsing process.

I took a look - very impressive, simple and declarative.

Please do keep letting the community know about these new tools, e.g. via twitter #fsharp tag

@robreno
Copy link

robreno commented Jan 23, 2023

@xp44mm Thank you for your kind words :)

Yes, please do choose another name. Perhaps FsLexYaccPlus or FsLexYaccAlt or just some entirely new name

Renamed the repo per dsyme's request to FslexFsyaccEx for purposes of studying the codebase.

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

No branches or pull requests

3 participants