CEP 902 - Build parser from grammar file

The idea is to genereate the parser starting from the Python standard definition Grammar

# Python24.gra
...
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
while_stmt: 'while' test ':' suite ['else' ':' suite]
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
try_stmt: ('try' ':' suite
           ((except_clause ':' suite)+
            ['else' ':' suite]
            ['finally' ':' suite] |
           'finally' ':' suite))
...

the main benefit is that you don't need to modify the parser code by hand. This is not much a issue from python 2.3 to 2.5 but think to Python3000 support where Grammar change slightly more. The Full Python2.5 Task will benefit from this stage. You generate the parser from a grammar file

parser = build_parser ('Python24.gra')

All this machinery is already done.

enhancements/Parser (last edited 2009-03-01 01:02:25 by localhost)