Closed xp44mm closed 2 years ago
cc @baronfel
@xp44mm can you briefly explain difference with this repo / benefits of using new one?
FSharpCompiler
is a generic compiler generator written in F# language.
Its rules do not contain semantic actions, so it is programming language independent. you can use any language you are familiar with to write your compiler.
You can iteratively apply regular expressions or context-free grammar to syntax sequences(input tokens) using combination approachs. Using it is as easy as Regex
.
@xp44mm, and how does it compare to FParsec?
@kkm000, The FSharpCompiler, It is a compiler of lex/yacc syntax, more like fslexyacc.
@xp44mm, I see. On the surface, yacc looks like yet another yacc (yayacc, given that "yacc" stands for "yet another compiler compiler"). What's the principal difference?
In the lexer, I could not understand what do you mean by "combination approach" (this is why I asked about FParsec, even before looking). It does not look like a library of combinators.
"combination approach" in lex/yacc refers to the combination of lex-generated analyzer or yacc-generated parser. while, the traditional compiler can only be used once in lex-> yacc->ast
.
@sergey-tihon @baronfel As far as parsing combinators go, I just discovered https://teo-tsirpanis.github.io/Farkle/. I have not played it it yet. Wondering if you know and how good it is. Recently FParsec was my go-to parser (e.g., I used one for the ABNF form defined by WWWC for SRGS grammars). I like it (or maybe just get used to it), but explicitly accepting whitespace may get annoying. I had to define 3 combinators for whitespace in different contexts (e.g., in a file header linefeed is significant; in others any whitespace including LF is optional and in yet others it's not). A source of confusion and errors, indeed.
The package FSharpCompiler
is legacy and is no longer maintained. Replace this package with the FslexFsyacc package, which implements all the features of this package and is more friendly.
Thanks!
Lex/Yacc programming enthusiasts, including the maintainers of this repo, I am very pleased to invite you to try a new series of lex/yacc tools. It is a very powerful, easy-to-use next-generation series of Lex/Yacc tools.
The open source see to: xp44mm/FSharpCompiler
The usage of
FSharpCompiler.Lex
andFSharpCompiler.Analyzing
, see the resolution: xp44mm/PolynomialExpressionsThe usage of
FSharpCompiler.Yacc
andFSharpCompiler.Parsing
, see the resolution: xp44mm/ArithmeticExpressions