-
Notifications
You must be signed in to change notification settings - Fork 1
/
csb.cfg
51 lines (45 loc) · 1.48 KB
/
csb.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
CSB = ( _ {RULE})* _ ;
RULE = $(\.?) {NT} _ \= _ {R} _ \; ;
.R = {R2} | {CAPTURE} | {SET} | {SHOW};
.R2 = {R3} | {ALT};
.R3 = {R4} | {CAT};
.R4 = {R5} | {UNY};
.R5 = {EPS} | {C} | {SPACE} | {NONT} | {PAREN} | {SAVE} | {ASSERT};
.PAREN = \( _ {R} _ \);
CAPTURE= {R} _ \@ _ {VAR};
SET = {VAR} _ \= _ {EXP};
ASSERT = \[ _ {EXP} _ \];
EPS = \( _ \);
NONT = \{ _ {NT} (\s+ {EXP} | \({EXP}\))? _ \};
SAVE = \$\( _ {R} _ \);
SHOW = \${VAR};
UNY = {R5}$(\* | \+ | \?);
CAT = {R4} _ {R4} (_ {R4})*;
ALT = {R3} _ \| _ {R3}(_ \| _ {R3})*;
C = $(\w | \. | \\.);
NT = $(\a(\w | \_)*);
SPACE = \_;
.EXP = {EXP_2} | {EQUALS} | {LESS} | {LEQ} | {NEQ} | {GREATER} | {GEQ};
.EXP_2 = {EXP_3} | {SUM};
.EXP_3 = {EXP_4} | {PROD};
.EXP_4 = {EXP_5} | {MINUS};
.EXP_5 = {UNIT} | {INT} | {CHAR} | {STR} | \( _ {EXP} _ \) | {VAR} | {LEN} | {GETCHAR} | {ATOI};
EQUALS = {EXP_2} _ \= _ {EXP_2};
NEQ = {EXP_2} _ \!\= _ {EXP_2};
LESS = {EXP_2} _ \< _ {EXP_2};
LEQ = {EXP_2} _ \<\= _ {EXP_2};
GREATER = {EXP_2} _ \> _ {EXP_2};
GEQ = {EXP_2} _ \>\= _ {EXP_2};
SUM = {EXP_3}( _ (\+ _ {EXP_3} | {MINUS}))+;
PROD = {EXP_4}( _ \* _ {EXP_4})+;
MINUS = \- _ {EXP_5};
NOT = \! _ {EXP_5};
GETCHAR = {EXP} _ \[ _ {EXP} _ \];
LEN = len _ \( _ {EXP} _ \);
ATOI = int _ \( _ {EXP} _ \);
UNIT = \(\);
INT = $(\d+);
CHAR = \'{EC}\';
STR = \"{EC}*\";
EC = $(\w | \\.);
VAR = $(\a(\w | \_)*);