# New Ticket Created by Allison Randal
# Please include the string: [perl #38406]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38406 >
I've spent too much time on this error, so I'm routing around it, but
I'd love to figure out what's causing it. In my local version of
Punie I get this error when I run 'make test':
t/io_print.....ok 5/8
# Failed test (t/io_print.t at line 29)
# got: 'error:imcc:syntax error, unexpected $undefined,
expecting '\n'
# in file 'EVAL_8' line 67
# '
# expected: 'ok 1
# ok 2
# '
# './parrot languages/punie/punie.pbc /Volumes/lilalUFS/projects/svk/
parrot/languages/punie/t/io_print_6.p1' failed with exit code 18
(The error comes from line 3892 or 3897 of compilers/imcc/imcparser.c.)
Obviously it's a syntax error in some PIR code, and I thought it was
in the PIR code output by Punie. It turns out it's actually the PIR
code output by PGE for TGE's grammar parser. (I discovered this with
TEST_PROG_ARGS="-D20".) For some reason, the generated PIR code for
the 'skip' rule is truncated part-way through the 67th line. (The
rule is defined in compilers/tge/TGE/Parser.pir on line 32.)
The truncated rule code occurs when I run the test code through the
bytecode version of the Punie compiler, punie.pbc (running 'make
test' or 'perl t/io_print.t' or 'parrot languages/punie/punie.pbc
languages/punie/t/io_print_6.p1'). But, if I run t/io_print_6.p1
through punie.pir instead of the bytecode version, the rule code is
fully generated and I get no errors. (I recompiled several times just
to make sure they were simply compiled and source versions the same
code.) Also, if I modify the Punie compiler to dump out generated PIR
to a file before it executes it, I get no errors even on the bytecode
version.
Here are the relevant lines from the truncated rule code (the last 3
lines in the generated code):
65 R: ## 62
66
67 R62: #
And the corresponding lines from the fully generated rule code, and
several lines following:
65 R: ## 62
66
67 R62: # \s {0..2147483647}
68 $I0 = find_not_cclass 32, target, pos, lastpos
69 rep = $I0 - pos
70 if rep < 0 goto fail
71 if rep <= 2147483647 goto R62_1
72 rep = 2147483647
73 R62_1:
...
(Oh, the change that started the error was adding a single rule to
Punie's PGE grammar. It doesn't matter if the new rule gets called
from any other rule, or if the rule even has any content. The name of
the rule also doesn't impact the error (I had a problem before
defining a PGE rule named 'print', so I had to check).)
That's as far as I've debugged it so far. I'd welcome any thoughts on
the cause, or suggestions on ways to debug it further.
Thanks,
Allison