-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLLgrammar.txt
89 lines (73 loc) · 2.2 KB
/
LLgrammar.txt
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
77
78
79
80
81
82
83
84
85
86
87
88
89
## S - init stav
ProgramBody ::= FceDefine ProgramBody
ProgramBody ::= Command ProgramBody
ProgramBody ::=''
## Command
Command ::= DeclareVariable
Command ::= Condition
Command ::= While
Command ::= Return
Command ::= Exp semicolon
Command ::= semicolon
Command ::= FceCall
## Definice funkcí
FceDefine ::= functionKey FceHeader curlyBraceLeft FunctionBody curlyBraceRight
FceHeader ::= identifierFunc leftPar FunctionDeclareParams rightPar colon FuncReturnColonType
FunctionDeclareParams ::=''
FunctionDeclareParams ::= DataType DeclareParam CommaOrEpsParams
CommaOrEpsParams ::=''
CommaOrEpsParams ::= comma DataType DeclareParam CommaOrEpsParams
DeclareParam ::= identifierVar
## FuncReturnType
FuncReturnColonType ::= DataType
FuncReturnColonType ::= voidKey
## Function call
FceCall ::= identifierFunc leftPar FirstFceParam rightPar
FirstFceParam ::=''
FirstFceParam ::= Statement CommaOrEpsParam
CommaOrEpsParam ::=''
CommaOrEpsParam ::= comma Statement CommaOrEpsParam
## Statement (simple expression)
Statement ::= identifierVar
Statement ::= floatLiteral
Statement ::= stringLiteral
Statement ::= integerLiteral
Statement ::= nullKey
## Exp
Exp ::= Statement
Exp ::= Exp minusOp Exp
Exp ::= Exp plusOp Exp
Exp ::= Exp divisionOp Exp
Exp ::= Exp multiplicationOp Exp
Exp ::= Exp concatenationOp Exp
Exp ::= Exp lesserThanOp Exp
Exp ::= Exp lesserEqOp Exp
Exp ::= Exp greaterThanOp Exp
Exp ::= Exp greaterEqOp Exp
Exp ::= Exp eqOp Exp
Exp ::= Exp notEqOp Exp
Exp ::= leftPar Exp rightPar
## Data types DataType
DataType ::= stringNullKey
DataType ::= floatNullKey
DataType ::= intNullKey
DataType ::= stringKey
DataType ::= floatKey
DataType ::= intKey
## Definice proměné
DeclareVariable ::= identifierVar equals DefVarAss
DefVarAss ::= Exp semicolon
DefVarAss ::= FceCall semicolon
## Podmínky
Condition ::= ifKey leftPar Exp rightPar curlyBraceLeft FunctionBody curlyBraceRight ElseCond
ElseCond ::= elseKey curlyBraceLeft FunctionBody curlyBraceRight
ElseCond ::=''
## While
While ::= whileKey leftPar Exp rightPar curlyBraceLeft FunctionBody curlyBraceRight
## Return
Return ::= returnKey ReturnExp semicolon
ReturnExp ::= Exp
ReturnExp ::=''
## Vnítřek funkce
FunctionBody ::= Command FunctionBody
FunctionBody ::=''