summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/pt/include/example/expr_peg.inc
blob: 0437c32111dc9a5313fba8d504e8c559642b6180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
[example {
PEG calculator (Expression)
    Digit      <- '0'/'1'/'2'/'3'/'4'/'5'/'6'/'7'/'8'/'9'       ;
    Sign       <- '-' / '+'                                     ;
    Number     <- Sign? Digit+                                  ;
    Expression <- Term (AddOp Term)*                            ;
    MulOp      <- '*' / '/'                                     ;
    Term       <- Factor (MulOp Factor)*                        ;
    AddOp      <- '+'/'-'                                       ;
    Factor     <- '(' Expression ')' / Number                   ;
END;
}]