parserz
parserz copied to clipboard
A purely-functional library for creating both parsers, pretty-printers, and grammar definitions from a single, type-safe specification of a grammar
⚠️ Interesting code here: - `final def parser[S, E, A]` function in `ParserModule2` - `InOut.scala` - changes to the test. _The rest is a copy-paste of existing code, please ignore...
Connects #75 Ultimately I am pursuing the following flow: 1. Have user-defined AST1 in terms of `Grammar.GADT` 2. Rewrite / Optimize AST1 into another AST2 expressed as low level `GADT`...
These are current signatures of parser and printer ```scala def parser[S, E, A](grammar: Grammar[S, S, E, A]): (S, Input) => (S, E \/ (Input, A)) def printer[S, E, A](grammar: Grammar[S,...
Currently state is exposed in grammars ```scala sealed abstract class Grammar[-SI, +SO, +E, A] ``` This results in state container (a Tuple) being allocated and returned at each step of...
Given we have the following combinators ```scala def ~ [SI1 : SO, E1 >: E, B](that: Grammar[SI1, SO1, E1, B]): Grammar[SI1, SO1, E1, A /\ B] def | [SI1 :...
Given the idea described in #75, will it be possible to use Magnolia to derive instances like ```scala final case class Person(name: String, age: Int, address: String) implicit val personEquiv:...
Grammar cannot be a Monad, but it may look like it
Requires spartanz/sbt-org-policies#3
Everywhere in this file, I'd make sure you are aggressively lazy, so we can have recursive grammars. It will require a trick (identity map) to derive the graph from that,...