-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.c
49 lines (41 loc) · 948 Bytes
/
main.c
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
/*
** The author of this program disclaims copyright.
*/
int main()
{
void* pParser = ParseAlloc (malloc);
struct Token t0 = { 40, 0 };
struct Token t1 = { 2, 0 };
/* First input:
** 40 - 2
*/
Parse (pParser, NUM, t0);
Parse (pParser, MINUS, t0);
Parse (pParser, NUM, t1);
Parse (pParser, 0, t0);
/* Second input:
** 40 + 2
*/
Parse (pParser, NUM, t0);
Parse (pParser, PLUS, t0);
Parse (pParser, NUM, t1);
Parse (pParser, 0, t0);
/* Third input:
** 40 * 2 + 2 / 2
*/
Parse (pParser, NUM, t0);
Parse (pParser, TIMES, t0);
Parse (pParser, NUM, t1);
Parse (pParser, PLUS, t0);
Parse (pParser, NUM, t1);
Parse (pParser, DIVIDE, t0);
Parse (pParser, NUM, t1);
Parse (pParser, 0, t0);
ParseFree(pParser, free);
return 0;
}
/* Local Variables: */
/* c-basic-offset: 4 */
/* tab-width: 4 */
/* indent-tabs-mode: t */
/* End: */