# November 2012 Archives

## Algebra of Grammars?

As in "*I* can parse integers and *F* can parse floats so *I* + *F* must parse integers *and* floats".

Not sure what *I* * *F* must do though. :)

Akin to parser combinators, perhaps.

Executable notation with Marpa just as the relational algebra is executable with SQL.

Looks like an algebra of grammars be defined in terms of their parseable sets (Algebra of Sets). Then *I* * *F* must parse only integers (intersection).

And then, if a problem domain can be reduced to an algebra of parseable entities, it must be parsed by an algebra of grammars with all benefits of mixing, matching, and reusing grammars at will.

That's all probably looks too trivial or too vague, but it starts making much more sense (to me at least) when doing general practical BNF parsing with Marpa::R2 now that grammars like this see the light of day.

## A Lexer for Marpa::R2

This proof-of-concept lexer (module, test) extracts literals (and other terminals) from a Marpa::R2::Grammar and turns them to regexes to tokenize string input for Marpa::R2::Recognizer.