Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
teaching
nswi098
Cecko
skeleton
Commits
ec84e846
Commit
ec84e846
authored
Oct 20, 2020
by
Bednárek David RNDr. Ph.D.
Browse files
gold files
parent
0bc35cdd
Changes
6
Hide whitespace changes
Inline
Side-by-side
test/test1.cecko1.gold
View file @
ec84e846
1: ETYPE int
1: identifier [fib]
1: (
1: ETYPE int
1: identifier [p]
1: )
1: ;
3: struct
3: identifier [Str]
3: {
4: const
4: ETYPE char
4: *
4: identifier [key]
4: ;
3: ETYPE int
3: identifier [fib]
3: (
3: ETYPE int
3: identifier [p]
3: )
3: ;
5: struct
5: identifier [Str]
5: *
5: identifier [next]
5: ;
6: }
5: {
6: const
6: ETYPE char
6: *
6: identifier [key]
6: ;
8: struct
8: identifier [Str]
8: *
8: identifier [root]
7: struct
7: identifier [Str]
7: *
7: identifier [next]
7: ;
8: }
8: ;
10: struct
10: identifier [Str]
10: identifier [array]
10: [
10: integer literal 1000
10: ]
10: *
10: identifier [root]
10: ;
11: ETYPE int
11: identifier [array_end]
11: ;
13: struct
13: identifier [Str]
13: *
13: identifier [get_str]
13: (
13: void
13: )
14: {
12: struct
12: identifier [Str]
12: identifier [array]
12: [
12: integer literal 1000
12: ]
12: ;
13: ETYPE int
13: identifier [array_end]
13: ;
15: struct
15: identifier [Str]
15: *
15: identifier [p]
15: ;
16: identifier [p]
16: =
16: &
16: identifier [array]
16: [
16: identifier [array_end]
16: ]
16: ;
17: identifier [array_end]
17: =
17: identifier [array_end]
17: ADDOP +
17: integer literal 1
15: identifier [get_str]
15: (
15: void
15: )
16: {
17: struct
17: identifier [Str]
17: *
17: identifier [p]
17: ;
18: return
18: identifier [p]
18: =
18: &
18: identifier [array]
18: [
18: identifier [array_end]
18: ]
18: ;
19: }
21: void
21: identifier [push_front]
21: (
21: struct
21: identifier [Str]
21: *
21: *
21: identifier [rootp]
21: ,
21: const
21: ETYPE char
21: *
21: identifier [key]
21: )
22: {
19: identifier [array_end]
19: =
19: identifier [array_end]
19: ADDOP +
19: integer literal 1
19: ;
20: return
20: identifier [p]
20: ;
21: }
23: void
23: identifier [push_front]
23: (
23: struct
23: identifier [Str]
23: *
23: identifier [p]
23: ;
24: identifier [p]
24: =
24: identifier [get_str]
24: (
24: )
24: ;
25: (
23: *
23: identifier [rootp]
23: ,
23: const
23: ETYPE char
23: *
23: identifier [key]
23: )
24: {
25: struct
25: identifier [Str]
25: *
25: identifier [p]
25: )
25: .
25: identifier [key]
25: =
25: identifier [key]
25: ;
26: (
26: *
26: identifier [p]
26: )
26: .
26: identifier [next]
26: =
26: *
26: identifier [rootp]
26: identifier [get_str]
26: (
26: )
26: ;
27: (
27: *
27: identifier [rootp]
27: =
27: identifier [p]
27: )
27: .
27: identifier [key]
27: =
27: identifier [key]
27: ;
28: }
30: ETYPE _Bool
30: identifier [empty]
30: (
30: struct
30: identifier [Str]
30: *
30: *
30: identifier [rootp]
30: )
31: {
32: return
32: !
28: (
28: *
28: identifier [p]
28: )
28: .
28: identifier [next]
28: =
28: *
28: identifier [rootp]
28: ;
29: *
29: identifier [rootp]
29: =
29: identifier [p]
29: ;
30: }
32: ETYPE _Bool
32: identifier [empty]
32: (
32: struct
32: identifier [Str]
32: *
32: *
32: identifier [rootp]
32: ;
33: }
35: const
35: ETYPE char
35: *
35: identifier [front]
35: (
35: struct
35: identifier [Str]
35: *
35: *
35: identifier [rootp]
35: )
36: {
37: return
32: )
33: {
34: return
34: !
34: *
34: identifier [rootp]
34: ;
35: }
37: const
37: ETYPE char
37: *
37: identifier [front]
37: (
37: struct
37: identifier [Str]
37: *
37: *
37: identifier [rootp]
37: )
37: .
37: identifier [key]
37: ;
38: }
40: void
40: identifier [pop_front]
40: (
40: struct
40: identifier [Str]
40: *
40: *
40: identifier [rootp]
40: )
41: {
42: *
42: identifier [rootp]
42: =
38: {
39: return
39: (
39: *
39: *
39: identifier [rootp]
39: )
39: .
39: identifier [key]
39: ;
40: }
42: void
42: identifier [pop_front]
42: (
42: struct
42: identifier [Str]
42: *
42: *
42: identifier [rootp]
42: )
42: .
42: identifier [next]
42: ;
43: }
45: ETYPE int
45: identifier [fib]
45: (
45: ETYPE int
45: identifier [x]
45: )
46: {
43: {
44: *
44: identifier [rootp]
44: =
44: (
44: *
44: *
44: identifier [rootp]
44: )
44: .
44: identifier [next]
44: ;
45: }
47: ETYPE int
47: identifier [s]
47: ;
48: if
48: (
48: identifier [x]
48: CMPO <=
48: integer literal 2
48: )
49: return
49: integer literal 1
47: identifier [fib]
47: (
47: ETYPE int
47: identifier [x]
47: )
48: {
49: ETYPE int
49: identifier [s]
49: ;
50:
else
5
1
:
{
5
2
: identifier [
s
]
5
2
: =
5
2
: i
dentifier [fib]
5
2
:
(
5
2
:
identifier [x]
5
2
:
ADDOP -
5
2
:
integer literal 1
52:
)
5
2
:
ADDOP +
5
2
: identifier [
fib
]
5
2
:
(
5
2
: identifier [
x
]
5
2
:
ADDOP -
5
2
: i
nteger literal 2
5
2
:
)
5
2
:
;
5
3
:
return
5
3
:
identifier [s]
5
3
:
;
54:
}
5
5
:
}
5
7
:
void
5
7
: i
dentifier [stringtest]
5
7
:
(
5
7
:
void
5
7
:
)
5
8
:
{
5
9
:
ETYPE char
5
9
:
identifier [arr]
5
9
:
[
59:
integer literal 100
59: ]
59:
;
60: ETYPE int
60: identifier [i]
60:
;
50:
if
5
0
:
(
5
0
: identifier [
x
]
5
0
:
CMPO <
=
5
0
: i
nteger literal 2
5
0
:
)
5
1
:
return
5
1
:
integer literal 1
5
1
:
;
52:
else
5
3
:
{
5
4
: identifier [
s
]
5
4
:
=
5
4
: identifier [
fib
]
5
4
:
(
5
4
: i
dentifier [x]
5
4
:
ADDOP -
5
4
:
integer literal 1
5
4
:
)
5
4
:
ADDOP +
5
4
:
identifier [fib]
54:
(
5
4
:
identifier [x]
5
4
:
ADDOP -
5
4
: i
nteger literal 2
5
4
:
)
5
4
:
;
5
5
:
return
5
5
:
identifier [s]
5
5
:
;
5
6
:
}
5
7
:
}
59:
void
59:
identifier [stringtest
]
59:
(
59: void
59: )
60:
{
61: ETYPE char
61: identifier [
t
]
61: identifier [
arr
]
61: [
61: integer literal
4
0
61: integer literal
10
0
61: ]
61: ;
62: identifier [printf]
62: (
62: string literal "... stringtest ...\x0a"
62: )
62: ETYPE int
62: identifier [i]
62: ;
63: identifier [sprintf]
63: (
63: identifier [arr]
63: ,
63: string literal "%d %s"
63: ,
63: integer literal 1
63: ,
63: string literal "text"
63: )
63: ETYPE char
63: identifier [t]
63: [
63: integer literal 40
63: ]
63: ;
64: identifier [printf]
64: (
64: string literal "sprintf: %s\x0a"
64: ,
64: identifier [arr]
64: string literal "... stringtest ...\x0a"
64: )
64: ;
65: identifier [i]
65: =
65: ADDOP -
65: identifier [sprintf]
65: (
65: identifier [arr]
65: ,
65: string literal "%d %s"
65: ,
65: integer literal 1
65: ,
65: string literal "text"
65: )
65: ;
66: identifier [
t
]
66:
[
66:
integer
literal
0
66:
]
66:
=
66:
integer literal 0
66: identifier [
printf
]
66:
(
66:
string
literal
"sprintf: %s\x0a"
66:
,
66:
identifier [arr]
66:
)
66: ;
67: identifier [sscanf]
67: (
67: identifier [arr]
67: ,
67: string literal "%d%s"
67: ,
67: &
67: identifier [i]
67:
,
67:
identifier [t]
67:
)
67:
=
67:
ADDOP -
67:
integer literal 1
67: ;
68: identifier [printf]
68: (
68: string literal "sscanf: %d %s\x0a"
68: ,
68: identifier [i]
68: ,
68: identifier [t]
68: )
68: [
68: integer literal 0
68: ]
68: =
68: integer literal 0
68: ;
74: identifier [memset]
74: (
74: identifier [t]
74: ,
74: integer literal 88
74: ,
74: integer literal 39
74: )
74: ;
75: identifier [t]
75: [
75: integer literal 39
75: ]
75: =
75: integer literal 0
75: ;
76: identifier [printf]
69: identifier [sscanf]
69: (
69: identifier [arr]
69: ,
69: string literal "%d%s"
69: ,
69: &
69: identifier [i]
69: ,
69: identifier [t]
69: )
69: ;
70: identifier [printf]
70: (
70: string literal "sscanf: %d %s\x0a"
70: ,
70: identifier [i]
70: ,
70: identifier [t]
70: )
70: ;
76: identifier [memset]
76: (
76: string literal "%s\x0a"
76: ,
76: identifier [t]
76: ,
76: integer literal 88
76: ,
76: integer literal 39
76: )
76: ;
77: }
79: void
79: identifier [pointerarithmeticstest]
79: (
79: void
79: )
80: {
81: ETYPE char
81: identifier [arr]
81: [
81: integer literal 27
81: ]
81: ;
82: ETYPE char
82: *
82: identifier [p]
82: ;
77: identifier [t]
77: [
77: integer literal 39
77: ]
77: =
77: integer literal 0
77: ;
78: identifier [printf]
78: (
78: string literal "%s\x0a"
78: ,
78: identifier [t]
78: )
78: ;
79: }
81: void
81: identifier [pointerarithmeticstest]
81: (
81: void
81: )
82: {
83: ETYPE char
83: *
83: identifier [e]
83: identifier [arr]
83: [
83: integer literal 27
83: ]
83: ;
84: ETYPE char
84: identifier [ch]
84: *
84: identifier [p]
84: ;
85: identifier [printf]
85: (
85: string literal "... pointerarithmeticstest ...\x0a"
85: )
85: ETYPE char
85: *
85: identifier [e]
85: ;
86: ETYPE char
86: identifier [ch]
86: =
86: integer literal 65
86: ;
87: identifier [p]
87: =
87: identifier [arr]
87: identifier [printf]
87: (
87: string literal "... pointerarithmeticstest ...\x0a"
87: )
87: ;
88: identifier [
e
]
88: identifier [
ch
]
88: =
88: identifier [arr]
88: ADDOP +
88: integer literal 26
88: integer literal 65
88: ;
89: while
89: (
89: identifier [p]
89: CMPE !=
89: identifier [e]
89: )
90: {
91: *
89: =
89: identifier [arr]
89: ;
90: identifier [e]
90: =
90: identifier [arr]
90: ADDOP +