parser = Parser(grammar) result = parser.parse(src, processor=myprocessor)
assign := name, '=', value
file := if_stmt+ if_stmt := 'if', ts, boolexpr, ts, ':', ts, suite def_stmt := 'def', ts, 'foo()', ts, ':', ts, suite >ts< := [ \t]* boolexpr := atom, ts, '=='/'!='/'>='/'<=', ts, atom suite := '\n', indent, stmt+, dedent atom := number/string indent := '\017' dedent := '\016' stmt := if_stmt/def_stmt/atom_stmt atom_stmt := atom, ts, '\n'