December 07, 2001
Parsing with the offside rule Some languages, such as C, Java and Perl use braces to delimit blocks, others, such as Python and Haskell use indentation. Lexing and parsing the former is easy with "modern" tools, such as ANTLR, but how do you build a lexer and parser for the latter? I've poked around a bit on the web and found a very small number of resources that might help. Very little out there actually. First a newsgroup discussion from comp.compilers.tools.pccts that provides some useful pointers. It actually uses ANTLR. The JavaCC mailing list archives has a thread (you have to scroll down a bit) discussing how to do this. A couple of posts from comp.compilers touching on how to do this in Bison. Sugar is a remarkably small amount of Scheme code to add indentation based syntax to that language. Posted by Alex at December 07, 2001 08:35 AM
Comments
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?