UpstandingHackers/hammer

Optional Runtime Parameters for Parsers

jrozner opened this issue · 0 comments

It would be useful to be able to pass runtime options to a parser that will be bound to all sub parsers and can be used to specify optional grammars for a set of parsers.

For example: If an application that a parser is being written for has run-time options that the user defines, such as making whitespace significant or non-significant, being able to specify what that runtime option is to the parser and conditionally modify the parser at runtime.

So a function "Parse" could take an input and an optional map of options and then bind those options to the scope of the entry point into the "Parse" function and all subparsers that it calls. Then the parser definition could reference the value in the map and depending on the value of a specific option change at runtime which path a parser takes.