« first day (1106 days earlier)      last day (290 days later) » 

4:21 AM
I'm trying to either find or come up with a superset of syntax for a parser expression grammar that allows you to do dynamic grammars. Does such a thing exist? An example usage would be writing a high-level grammar that parses a string and the result can either return an expression tree or throw based on whether some way of providing valid operators, their respective operator precedence, and their implementations allows the initial string to parse or not.
 
4:55 AM
Perhaps a language for that is overkill though
maybe I should come up with a way to specify supported operators and their precedence and generate a PEG from those
 
 
1 hour later…
6:25 AM
@PatrickRoberts Monadic parser combinator libraries in functional languages (such as Parsec in Haskell) allow you to do dynamic grammars.
 
I know less than nothing about haskell, but I'd love to apply the concept. Is there a generalized name for such a construct?
 
The basic idea behind monadic parsers is that a parser has some kind of "return value" (in general, a parse tree). You use the return value of one parser to compute a new parser.
Let's denote a parser returning a value of type a as Parser a.
 
Then if you have a Parser a and a function that can turn an a into a Parser b (functions are denoted as a -> Parser b) then you can compose these into a larger Parser b.
There is an operator that does this called >>=.
 
I'm looking for something to target JavaScript, TypeScript, or C++ preferably.
I'll read up on that though
 
7:31 AM
I've been reading this cs.nott.ac.uk/~pszgmh/monparsing.pdf it's quite interesting but it's a tad difficult for me to follow. The only language I know a little of which is even remotely similar is F#
 

« first day (1106 days earlier)      last day (290 days later) »