Lexer and parser (ported to C)