Skip to content

Instantly share code, notes, and snippets.

@atrodo
Created June 23, 2010 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atrodo/450522 to your computer and use it in GitHub Desktop.
Save atrodo/450522 to your computer and use it in GitHub Desktop.
.sub comp
.param string hll
.param string code
$P0 = compreg hll
unless_null $P0, compile
load_language "nqprx"
$P0 = compreg "NQP-rx"
compile:
$P1 = $P0."compile"(code)
$P1 = $P1()
typeof $S2, $P1
.return ($P1)
.end
.sub main :main
.local string code1
.local string code2
code1 = ' #sub (%p) { say("Hello World!"); };'
code2 = ' ##sub (%p) { say("Hello World!"); };'
comp('nqp', code1)
comp('nqp', "")
comp('nqp', code2)
.end
{atrodo@parrot}> embed/bin/parrot bug.pir
Confused at line 1, near " ##sub (%"
current instr.: 'parrot;HLL;Grammar;panic' pc 587 (src/cheats/hll-grammar.pir:220)
called from Sub 'parrot;NQP;Grammar;comp_unit' pc 6655 (gen/nqp-grammar.pir:1941)
called from Sub 'parrot;NQP;Grammar;TOP' pc 1296 (gen/nqp-grammar.pir:468)
called from Sub 'parrot;Regex;Cursor;parse' pc 369 (src/Regex/Cursor.pir:209)
called from Sub 'parrot;HLL;Compiler;parse' pc 115 (src/cheats/hll-compiler.pir:51)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 453 (compilers/pct/src/PCT/HLLCompiler.pir:322)
called from Sub 'comp' pc 22 (bug.pir:9)
called from Sub 'main' pc 76 (bug.pir:24)
{atrodo@parrot}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment