citron
citron copied to clipboard
An LALR Parser Generator for Swift
This is intended to be a replacement lexer; I hope it's of some use. I'm not attached to how or whether it is integrated. Of course I didn't make any...
Follow up: https://github.com/roop/citron/pull/27 cc @roop
There are more opportunities for good error reporting by adding more sourceLocations, e.g in this excerpt of generated code, ``` enum CitronSymbol { case yyBaseOfStack case yy0(CitronToken) case yy7(EBNF.AltList) case...
It appears SPM has a feature that would support running citron as part of a build. Citron could supply one. Please see https://github.com/apple/swift-evolution/blob/main/proposals/0303-swiftpm-extensible-build-tools.md#example-1-swiftgen
https://github.com/roop/citron/blob/a1b26d4049c3920a599e4df9f671712266988f96/Sources/citron/main.c#L3822 results in code like this when the action clause for a rule is empty: ```swift case 1: /* rule_list ::= */ func codeBlockForRule01() throws -> EBNF.RuleList { #sourceLocation(file: "Sources/ebnf-citron/EBNFGrammar.citron",...
I got an error today that pointed into the definition of `CitronSymbol` in the generated parser code. It would be nice if that could point back into the source file....
The tests should exercise the error capture functionality; they currently do not. Windows support is coming, but expect it to be a much bigger change because of the many workarounds...
Or better yet, there should be a way to request public accessibility for any/all of the components in the generated Swift code. Not having this limits usability.
All the examples seem to get built by SPM… except for that one!
When using Citron as an SPM package, the `CitronParser` protocol (which includes the core parsing code) ends up in a separate module from the generated parser. I found that this...