diff --git a/frontc/cparser.mly b/frontc/cparser.mly index 621d671..6eee33b 100644 --- a/frontc/cparser.mly +++ b/frontc/cparser.mly @@ -185,9 +185,11 @@ AND_EQ PIPE_EQ CIRC_EQ INF_INF_EQ SUP_SUP_EQ %% -interpret: file EOF {$1}; +interpret: file {$1}; -file: globals EOF {List.rev $1}; +file: + | EOF {[]} + | globals EOF {List.rev $1}; globals: | global {[$1]} diff --git a/test.t/empty.c b/test.t/empty.c new file mode 100644 index 0000000..e69de29 diff --git a/test.t/run.t b/test.t/run.t index 6c0c852..42b040c 100644 --- a/test.t/run.t +++ b/test.t/run.t @@ -1,3 +1,6 @@ + $ ../printc/printc_bin.exe empty.c + + $ ../printc/printc_bin.exe volatile.c typedef int const t1; @@ -32,6 +35,8 @@ + + $ ../printc/printc_bin.exe for.c void main() @@ -53,6 +58,8 @@ + + $ ../printc/printc_bin.exe from.c void main() @@ -85,6 +92,8 @@ + + $ ../printc/printc_bin.exe okp.c typedef int j_decompress_ptr, boolean, my_main_ptr, j_decompress_ptr, size_t,