-
Notifications
You must be signed in to change notification settings - Fork 0
/
grammar.cfg
76 lines (53 loc) · 2.03 KB
/
grammar.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
S -> STATEMENTS
STATEMENTS -> S_if
| S_assign
| S_alias_assign
| S_for
| EXPRESSIONS
EXPRESSIONS -> E_arithmetic
| E_compare
| E_alert
S_assign -> E_address _ R_is _ EXPRESSIONS
S_alias_assign -> E_alias _ R_is _ E_address
S_if -> S_if1
| S_if2
S_if1 -> "혹시 " _ EXPRESSIONS _ ("니?"|"이니?"|"야?") _ "그럼" NL S_if1 NL "아니면" NL S_if1
| (STATEMENTS NL):+ "해줘"
S_if2 -> "혹시 " _ EXPRESSIONS _ ("니?"|"이니?"|"야?") _ "그럼" NL S_if
| "혹시 " _ EXPRESSIONS _ ("니?"|"이니?"|"야?") _ "그럼" NL S_if1 NL "아니면" NL S_if2
S_for -> EXPRESSIONS _ "일 때 까지" NL (STATEMENTS NL):+ "해줘"
E_address -> "[" E_address_ "]"
E_address_ -> [가-힣]:+
E_alias -> "{" E_alias_ "}"
E_alias_ -> [가-힣]:+
E_value -> E_address
E_alias_value -> E_alias
E_valuable -> E_value
| E_alias_value
| E_number
| E_string
E_arithmetic -> E_arithmetic _ "더하기" _ E_arithmetic2
| E_arithmetic _ "빼기" _ E_arithmetic2
| E_arithmetic2
E_arithmetic2 -> E_arithmetic2 _ "곱하기" _ E_arithmetic_terminal
| E_arithmetic2 _ "나누기" _ E_arithmetic_terminal
| E_arithmetic_terminal
E_arithmetic_terminal -> E_valuable
E_compare -> EXPRESSIONS _ R_iis _ EXPRESSIONS _ "보다 크다"
| EXPRESSIONS _ R_iis _ EXPRESSIONS _ "보다 작다"
| EXPRESSIONS _ R_iis _ EXPRESSIONS _ "보다 크거나 같다"
| EXPRESSIONS _ R_iis _ EXPRESSIONS _ "보다 작거나 같다"
| EXPRESSIONS _ R_iis _ EXPRESSIONS _ ("와"|"과") " 같다"
E_alert -> "뿅" _ [!]:+ _ "(" _ E_alert_ _ ")"
E_alert_ -> E_alert_ _ "," _ EXPRESSIONS
| EXPRESSIONS
E_number -> [0-9]:+
E_string -> "'" E_string_ "'"
E_string_ -> [가-힣|\s|0-9|!?\.,\[\]\*\+-/]:+
R_is -> "는"
| "은"
R_iis -> "가"
| "이"
| "이가"
_ -> [\s]:*
NL -> [\s|\r\n]:*