Changeset 8 for grammer/test.grm


Ignore:
Timestamp:
Oct 15, 2007, 8:28:00 AM (17 years ago)
Author:
george
Message:

Opraveno: Vytváření nové gramatiky z jiné. Zobrazení výsledku a další fáze parsování pascalu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grammer/test.grm

    r5 r8  
    1 ab1=bc | (s 'g') [{a}] .
     1program = block '.' .
     2block =  { declaration } statement .
     3declaration = constant | variable | function .
     4constant = CONST constant_definition { ',' constant_definition } ';' .
     5constant_definition = NAME '=' NUMBER .
     6variable = VAR NAME { ',' NAME } ';' .
     7function = FUNCTION NAME '(' [ NAME { ',' NAME } ]  ')' block ';' .
     8expression = [ ( '-' | '+' ) ] term { ( '-' | '+' ) term } .
     9term = factor { ( '*' | '/' ) factor } .
     10factor = NAME '(' [ expression { ',' expression } ] ')'
     11  | NUMBER | NAME | '(' expression ')' .
     12statement = [ NAME ':=' expression
     13  | BEGIN statement { ';' statement } END
     14  | IF condition THEN statement
     15  | WHILE condition DO statement
     16  | RETURN expression
     17  | WRITE expression ] .
     18condition = ODD expression
     19  | expression ( '=' | '<>' | '<' | '<=' | '>' | '>=' ) expression .
Note: See TracChangeset for help on using the changeset viewer.