-
Notifications
You must be signed in to change notification settings - Fork 14
/
original.c
1251 lines (1044 loc) · 19.8 KB
/
original.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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2021 Brian Callahan <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* NOTE: This is the original C implementation used to bootstrap the
* self-hosting compiler. It is no longer used but is the subject
* of the blog series found here:
* https://briancallahan.net/blog/20210814.html
*/
#include <sys/stat.h>
#include <ctype.h>
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifndef HAVE_STRTONUM
#include "strtonum.c"
#endif
#define PL0C_VERSION "1.2.0"
#define CHECK_LHS 0
#define CHECK_RHS 1
#define CHECK_CALL 2
#define TOK_IDENT 'I'
#define TOK_NUMBER 'N'
#define TOK_CONST 'C'
#define TOK_VAR 'V'
#define TOK_PROCEDURE 'P'
#define TOK_CALL 'c'
#define TOK_BEGIN 'B'
#define TOK_END 'E'
#define TOK_IF 'i'
#define TOK_THEN 'T'
#define TOK_ELSE 'e'
#define TOK_WHILE 'W'
#define TOK_DO 'D'
#define TOK_ODD 'O'
#define TOK_WRITEINT 'w'
#define TOK_WRITECHAR 'H'
#define TOK_WRITESTR 'S'
#define TOK_READINT 'R'
#define TOK_READCHAR 'h'
#define TOK_INTO 'n'
#define TOK_SIZE 's'
#define TOK_EXIT 'X'
#define TOK_AND '&'
#define TOK_OR '|'
#define TOK_NOT '~'
#define TOK_FORWARD 'F'
#define TOK_DOT '.'
#define TOK_EQUAL '='
#define TOK_COMMA ','
#define TOK_SEMICOLON ';'
#define TOK_ASSIGN ':'
#define TOK_HASH '#'
#define TOK_LESSTHAN '<'
#define TOK_GREATERTHAN '>'
#define TOK_LTEQUALS '{'
#define TOK_GTEQUALS '}'
#define TOK_PLUS '+'
#define TOK_MINUS '-'
#define TOK_MULTIPLY '*'
#define TOK_DIVIDE '/'
#define TOK_MODULO '%'
#define TOK_LPAREN '('
#define TOK_RPAREN ')'
#define TOK_LBRACK '['
#define TOK_RBRACK ']'
#define TOK_STRING '"'
/*
* pl0c -- PL/0 compiler.
*
* program = block "." .
* block = [ "const" ident "=" number { "," ident "=" number } ";" ]
* [ "var" ident [ array ] { "," ident [ array ] } ";" ]
{ "forward" ident ";" }
* { "procedure" ident ";" block ";" } statement .
* statement = [ ident ":=" expression
* | "call" ident
* | "begin" statement { ";" statement } "end"
* | "if" condition "then" statement [ "else" statement ]
* | "while" condition "do" statement
* | "readInt" [ "into" ] ident
* | "readChar" [ "into" ] ident
* | "writeInt" expression
* | "writeChar" expression
* | "writeStr" ( ident | string )
* | "exit" expression ] .
* condition = "odd" expression
* | expression ( comparator ) expression .
* expression = [ "+" | "-" | "not" ] term { ( "+" | "-" | "or" ) term } .
* term = factor { ( "*" | "/" | "mod" | "and" ) factor } .
* factor = ident
* | number
* | "(" expression ")" .
* comparator = "=" | "#" | "<" | ">" | "<=" | ">=" | "<>" .
* array = "size" number .
*/
static char *raw, *token;
static int depth, proc, type;
static size_t line = 1;
struct symtab {
int depth;
int type;
long size;
char *name;
struct symtab *next;
};
static struct symtab *head;
static void expression(void);
/*
* Misc. functions.
*/
static void
error(const char *fmt, ...)
{
va_list ap;
(void) fprintf(stderr, "pl0c: error: %lu: ", line);
va_start(ap, fmt);
(void) vfprintf(stderr, fmt, ap);
va_end(ap);
(void) fputc('\n', stderr);
exit(1);
}
static void
readin(char *file)
{
int fd;
struct stat st;
if (strrchr(file, '.') == NULL)
error("file must end in '.pl0'");
if (!!strcmp(strrchr(file, '.'), ".pl0"))
error("file must end in '.pl0'");
if ((fd = open(file, O_RDONLY)) == -1)
error("couldn't open %s", file);
if (fstat(fd, &st) == -1)
error("couldn't get size");
if ((raw = malloc(st.st_size + 1)) == NULL)
error("malloc failed");
if (read(fd, raw, st.st_size) != st.st_size)
error("couldn't read %s", file);
raw[st.st_size] = '\0';
(void) close(fd);
}
/*
* Lexer.
*/
static void
comment(void)
{
int ch;
while ((ch = *raw++) != '}') {
if (ch == '\0')
error("unterminated comment");
if (ch == '\n')
++line;
}
}
static int
ident(void)
{
char *p;
size_t i, len;
p = raw;
while (isalnum(*raw) || *raw == '_')
++raw;
len = raw - p;
--raw;
free(token);
if ((token = malloc(len + 1)) == NULL)
error("malloc failed");
for (i = 0; i < len; i++)
token[i] = *p++;
token[i] = '\0';
if (!strcmp(token, "const"))
return TOK_CONST;
else if (!strcmp(token, "var"))
return TOK_VAR;
else if (!strcmp(token, "procedure"))
return TOK_PROCEDURE;
else if (!strcmp(token, "call"))
return TOK_CALL;
else if (!strcmp(token, "begin"))
return TOK_BEGIN;
else if (!strcmp(token, "end"))
return TOK_END;
else if (!strcmp(token, "if"))
return TOK_IF;
else if (!strcmp(token, "then"))
return TOK_THEN;
else if (!strcmp(token, "else"))
return TOK_ELSE;
else if (!strcmp(token, "while"))
return TOK_WHILE;
else if (!strcmp(token, "do"))
return TOK_DO;
else if (!strcmp(token, "odd"))
return TOK_ODD;
else if (!strcmp(token, "writeInt"))
return TOK_WRITEINT;
else if (!strcmp(token, "writeChar"))
return TOK_WRITECHAR;
else if (!strcmp(token, "writeStr"))
return TOK_WRITESTR;
else if (!strcmp(token, "readInt"))
return TOK_READINT;
else if (!strcmp(token, "readChar"))
return TOK_READCHAR;
else if (!strcmp(token, "into"))
return TOK_INTO;
else if (!strcmp(token, "size"))
return TOK_SIZE;
else if (!strcmp(token, "exit"))
return TOK_EXIT;
else if (!strcmp(token, "and"))
return TOK_AND;
else if (!strcmp(token, "or"))
return TOK_OR;
else if (!strcmp(token, "not"))
return TOK_NOT;
else if (!strcmp(token, "mod"))
return TOK_MODULO;
else if (!strcmp(token, "forward"))
return TOK_FORWARD;
return TOK_IDENT;
}
static int
number(void)
{
const char *errstr;
char *p;
size_t i, j = 0, len;
p = raw;
while (isdigit(*raw) || *raw == '_')
++raw;
len = raw - p;
--raw;
free(token);
if ((token = malloc(len + 1)) == NULL)
error("malloc failed");
for (i = 0; i < len; i++) {
if (isdigit(*p))
token[j++] = *p;
++p;
}
token[j] = '\0';
(void) strtonum(token, 0, LONG_MAX, &errstr);
if (errstr != NULL)
error("invalid number: %s", token);
return TOK_NUMBER;
}
static int
string(void)
{
char *p;
size_t i, len, mod = 0;
p = ++raw;
restart:
while (*raw != '\'') {
if (*raw == '\n' || *raw == '\0')
error("unterminated string");
if (*raw++ == '"')
++mod;
}
if (*++raw == '\'') {
++raw;
goto restart;
}
--raw;
len = raw - p + mod;
if (len < 1)
error("impossible string");
free(token);
if ((token = malloc(len + 3)) == NULL)
error("malloc failed");
token[0] = '"';
for (i = 1; i <= len; i++) {
if (*p == '\'') {
token[i++] = '\\';
++p;
} else if (*p == '"') {
token[i++] = '\\';
}
token[i] = *p++;
}
token[i++] = '"';
token[i] = '\0';
if (len == 1 || (len == 2 && token[1] == '\\')) {
token[0] = '\'';
if (len == 1)
token[2] = '\'';
else
token[3] = '\'';
return TOK_NUMBER;
}
return TOK_STRING;
}
static int
lex(void)
{
again:
/* Skip whitespace. */
while (*raw == ' ' || *raw == '\t' || *raw == '\n') {
if (*raw++ == '\n')
++line;
}
if (isalpha(*raw) || *raw == '_')
return ident();
if (isdigit(*raw))
return number();
switch (*raw) {
case '{':
comment();
goto again;
case '.':
case '=':
case ',':
case ';':
case '#':
case '+':
case '-':
case '*':
case '/':
case '%':
case '(':
case ')':
case '[':
case ']':
return (*raw);
case '<':
if (*++raw == '=')
return TOK_LTEQUALS;
if (*raw == '>')
return TOK_HASH;
--raw;
return TOK_LESSTHAN;
case '>':
if (*++raw == '=')
return TOK_GTEQUALS;
--raw;
return TOK_GREATERTHAN;
case ':':
if (*++raw != '=')
error("unknown token: ':%c'", *raw);
return TOK_ASSIGN;
case '\'':
return string();
case '\0':
return 0;
default:
error("unknown token: '%c'", *raw);
}
return 0;
}
/*
* Code generator.
*/
static void
aout(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
(void) vfprintf(stdout, fmt, ap);
va_end(ap);
}
static void
cg_array(void)
{
aout("[%s]", token);
}
static void
cg_call(void)
{
aout("%s();\n", token);
}
static void
cg_closeblock(void)
{
aout(";}\n");
}
static void
cg_const(void)
{
if (proc == 0)
aout("static ");
aout("const long %s=", token);
}
static void
cg_crlf(void)
{
aout("\n");
}
static void
cg_end(void)
{
aout("/* PL/0 historical compiler %s */\n", PL0C_VERSION);
}
static void
cg_epilogue(void)
{
aout(";");
if (proc == 0)
aout("\nreturn 0;");
aout("\n}\n\n");
}
static void
cg_exit(void)
{
aout("exit(");
}
static void
cg_forward(void)
{
aout("static void %s(void);", token);
}
static void
cg_init(void)
{
aout("#include <limits.h>\n");
aout("#include <stdio.h>\n");
aout("#include <stdlib.h>\n");
aout("#include <string.h>\n\n");
aout("static char __stdin[24];\n");
aout("static const char *__errstr;\n\n");
aout("static long __writestridx;\n\n");
}
static void
cg_odd(void)
{
aout(")&1");
}
static void
cg_procedure(void)
{
if (proc == 0) {
aout("int\n");
aout("main(int argc, char *argv[])\n");
} else {
aout("static void\n");
aout("%s(void)\n", token);
}
aout("{\n");
}
static void
cg_readchar(void)
{
aout("%s=(int) fgetc(stdin);", token);
}
static void
cg_readint(void)
{
aout("(void) fgets(__stdin, sizeof(__stdin), stdin);\n");
aout("if(__stdin[strlen(__stdin) - 1] == '\\n')");
aout("__stdin[strlen(__stdin) - 1] = '\\0';");
aout("%s=(long) strtonum(__stdin, LONG_MIN, LONG_MAX, &__errstr);\n",
token);
aout("if(__errstr!=NULL){");
aout("(void) fprintf(stderr, \"invalid number: %%s\\n\", __stdin);");
aout("exit(1);");
aout("}");
}
static void
cg_rparen(void)
{
aout(")");
}
static void
cg_semicolon(void)
{
aout(";\n");
}
static void
cg_symbol(void)
{
switch (type) {
case TOK_IDENT:
case TOK_NUMBER:
aout("%s", token);
break;
case TOK_BEGIN:
aout("{\n");
break;
case TOK_END:
aout(";\n}\n");
break;
case TOK_IF:
aout("if(");
break;
case TOK_THEN:
aout("){");
break;
case TOK_DO:
aout(")");
break;
case TOK_ELSE:
aout(";}else{");
break;
case TOK_ODD:
aout("(");
break;
case TOK_WHILE:
aout("while(");
break;
case TOK_EQUAL:
aout("==");
break;
case TOK_ASSIGN:
aout("=");
break;
case TOK_HASH:
aout("!=");
break;
case TOK_LTEQUALS:
aout("<=");
break;
case TOK_GTEQUALS:
aout(">=");
break;
default:
aout("%c", type);
}
}
static void
cg_var(void)
{
if (proc == 0)
aout("static ");
aout("long %s", token);
}
static void
cg_writechar(void)
{
aout("(void) fprintf(stdout, \"%%c\", (unsigned char) (");
}
static void
cg_writeint(void)
{
aout("(void) fprintf(stdout, \"%%ld\", (long) (");
}
static void
cg_writestr(void)
{
struct symtab *curr, *ret;
if (type == TOK_IDENT) {
curr = head;
while (curr != NULL) {
if (!strcmp(curr->name, token))
ret = curr;
curr = curr->next;
}
if (ret == NULL)
error("undefined symbol: %s", token);
if (ret->size == 0)
error("writeStr requires an array");
aout("__writestridx = 0;\n");
aout("while(%s[__writestridx]!='\\0'&&__writestridx<%ld)\n",
token, ret->size);
aout("(void)fputc((unsigned char)%s[__writestridx++],stdout);\n",
token);
} else {
aout("(void)fprintf(stdout, %s);\n", token);
}
}
/*
* Semantics.
*/
static void
arraycheck(void)
{
struct symtab *curr, *ret = NULL;
curr = head;
while (curr != NULL) {
if (!strcmp(token, curr->name))
ret = curr;
curr = curr->next;
}
if (ret == NULL)
error("undefined symbol: %s", token);
if (ret->size == 0)
error("symbol %s is not an array", token);
}
static void
symcheck(int check)
{
struct symtab *curr, *ret = NULL;
curr = head;
while (curr != NULL) {
if (!strcmp(token, curr->name))
ret = curr;
curr = curr->next;
}
if (ret == NULL)
error("undefined symbol: %s", token);
switch (check) {
case CHECK_LHS:
if (ret->type != TOK_VAR)
error("must be a variable: %s", token);
break;
case CHECK_RHS:
if (ret->type == TOK_PROCEDURE || ret->type == TOK_FORWARD)
error("must not be a procedure: %s", token);
break;
case CHECK_CALL:
if (ret->type != TOK_PROCEDURE && ret->type != TOK_FORWARD)
error("must be a procedure: %s", token);
}
}
/*
* Parser.
*/
static void
next(void)
{
type = lex();
++raw;
}
static void
expect(int match)
{
if (match != type)
error("syntax error");
next();
}
static void
addsymbol(int type)
{
struct symtab *curr, *new;
curr = head;
while (1) {
if (!strcmp(curr->name, token)) {
if (curr->depth == (depth - 1)) {
if (curr->type == TOK_FORWARD &&
type == TOK_PROCEDURE) {
/* Don't error out! */
} else {
error("duplicate symbol: %s", token);
}
}
}
if (curr->next == NULL)
break;
curr = curr->next;
}
if ((new = malloc(sizeof(struct symtab))) == NULL)
error("malloc failed");
new->depth = depth - 1;
new->type = type;
new->size = 0;
if ((new->name = strdup(token)) == NULL)
error("malloc failed");
new->next = NULL;
curr->next = new;
}
static void
arraysize(void)
{
struct symtab *curr;
const char *errstr;
curr = head;
while (curr->next != NULL)
curr = curr->next;
if (curr->type != TOK_VAR)
error("arrays must be declared with \"var\"");
curr->size = strtonum(token, 1, LONG_MAX, &errstr);
if (errstr != NULL)
error("invalid array size");
}
static void
destroysymbols(void)
{
struct symtab *curr, *prev;
again:
curr = head;
while (curr->next != NULL) {
prev = curr;
curr = curr->next;
}
if (curr->type != TOK_PROCEDURE) {
free(curr->name);
free(curr);
prev->next = NULL;
goto again;
}
}
static void
initsymtab(void)
{
struct symtab *new;
if ((new = malloc(sizeof(struct symtab))) == NULL)
error("malloc failed");
new->depth = 0;
new->type = TOK_PROCEDURE;
new->size = 0;
new->name = "main";
new->next = NULL;
head = new;
}
static void
factor(void)
{
switch (type) {
case TOK_IDENT:
symcheck(CHECK_RHS);
cg_symbol();
expect(TOK_IDENT);
if (type == TOK_LBRACK) {
arraycheck();
cg_symbol();
expect(TOK_LBRACK);
expression();
if (type == TOK_RBRACK)
cg_symbol();
expect(TOK_RBRACK);
}
break;
case TOK_NUMBER:
cg_symbol();
expect(TOK_NUMBER);
break;
case TOK_LPAREN:
cg_symbol();
expect(TOK_LPAREN);
expression();
if (type == TOK_RPAREN)
cg_symbol();
expect(TOK_RPAREN);
}
}
static void
term(void)
{
factor();
while (type == TOK_MULTIPLY || type == TOK_DIVIDE ||
type == TOK_MODULO || type == TOK_AND) {
cg_symbol();
next();
factor();
}
}
static void
expression(void)
{
if (type == TOK_PLUS || type == TOK_MINUS || type == TOK_NOT) {
cg_symbol();
next();
}
term();
while (type == TOK_PLUS || type == TOK_MINUS || type == TOK_OR) {
cg_symbol();
next();
term();
}
}
static void
condition(void)
{
if (type == TOK_ODD) {
cg_symbol();
expect(TOK_ODD);
expression();
cg_odd();
} else {
expression();
switch (type) {
case TOK_EQUAL:
case TOK_HASH:
case TOK_LESSTHAN:
case TOK_GREATERTHAN:
case TOK_LTEQUALS:
case TOK_GTEQUALS:
cg_symbol();
next();
break;
default:
error("invalid conditional");
}
expression();
}
}
static void
statement(void)
{
switch (type) {
case TOK_IDENT:
symcheck(CHECK_LHS);
cg_symbol();
expect(TOK_IDENT);
if (type == TOK_LBRACK) {
arraycheck();
cg_symbol();
expect(TOK_LBRACK);
expression();
if (type == TOK_RBRACK)
cg_symbol();
expect(TOK_RBRACK);
}
if (type == TOK_ASSIGN)
cg_symbol();
expect(TOK_ASSIGN);
expression();
break;
case TOK_CALL:
expect(TOK_CALL);
if (type == TOK_IDENT) {
symcheck(CHECK_CALL);
cg_call();
}
expect(TOK_IDENT);
break;
case TOK_BEGIN:
cg_symbol();
expect(TOK_BEGIN);
statement();
while (type == TOK_SEMICOLON) {
cg_semicolon();
expect(TOK_SEMICOLON);