Friday, March 13, 2015

Announcing Classp--a classier way to parse

Classp demonstrates a new way to parse using class patterns instead of grammars. Class patterns are not just a different way to write a grammar (as for example parser combinators are), they are a significantly different way to describe a language. Class patterns are designed for compiler writers, transalator writers, and others who need to not only parse a language, but produce an abstract syntax tree.

Grammar-based systems require you to either live with a parse tree or write and maintain code to convert the parse tree into an abstract syntax tree. Classp is different: you start with the abstract syntax tree, written in modern object-oriented style with inheritance and declared types, and you write class patterns for each class. Classp takes this specification and generates the lexer in Flex, the parser in Bison, and the abstract syntax tree in C++11.

To learn more, visit http://google.github.io/classp.

No comments:

Post a Comment