-
Notifications
You must be signed in to change notification settings - Fork 0
/
Syntax.txt
75 lines (54 loc) · 1.2 KB
/
Syntax.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
program : body
body: stmline*
stm: var = exp |
if exp then stm |
if exp then "\n" body endif |
if exp then "\n" body else "\n" body endif
":" label
goto label
funcall
stmline: stm "\n"
var: numvar
const: numconst
numvar: id
label: id
op: + | - | * | / | % | & | "|" | = | <> | < | > | <= | >=
funcall: id "(" arglist ")"
arglist: <empty> | exp (, exp)*
LL(1) expression grammar:
exp: exp3 exp2
exp2: or exp | <empty>
exp3: exp5 exp4
exp4: and exp3 | <empty>
exp5: exp7 exp6
exp6: == exp5 | <> exp5 | <empty>
exp7: exp9 exp8
exp8: < exp7 | > exp7 | <= exp7 | >= exp7 | <empty>
exp9: term1 exp10
exp10: + exp9 | - exp9 | <empty>
term1: factor term2
term2: * term1 | / term1 | % term1 | <empty>
factor: const | var | (exp1) | -factor | not exp1 | funcall
/////// Interesting templates
Basic4GL
- "pointers", structs, arrays
FreeBasic
- Well documented, full type system, pointers, .bi-files for ffi with C code
///////
a = ""
b = 0.0
c = 1
a(2) = ("Jonas", "Test")
c(5) = (1, 2, 3, 4, 5)
b(5) = 0.0
d(5) = "" ' ("", "", "", "", "")
type test
a = ""
b = 0.0
c = 1
endtype
k = type test
k(2) = type test
k.a = "Hej"
k.b = 6.0
/////////////