Skip to content

Instantly share code, notes, and snippets.

@pmichaud
Created September 4, 2012 16:48
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 pmichaud/3623354 to your computer and use it in GitHub Desktop.
Save pmichaud/3623354 to your computer and use it in GitHub Desktop.
pmichaud@kiwi:~/p6/nqp$ cat eek.nqp
use NQPHLL;
class thing::Grammar is HLL::Grammar {
token TOP { <command> }
token command { 'eek' }
}
class thing::Actions is HLL::Actions {
method TOP($/) {
make $<command>.ast;
}
method command($/) {
make QAST::IVal.new( :value(3) )
}
}
class thing::Compiler is HLL::Compiler {}
sub MAIN(*@ARGS) {
my $compiler := thing::Compiler.new();
$compiler.language('thing');
$compiler.parsegrammar(thing::Grammar);
$compiler.parseactions(thing::Actions);
$compiler.command_line(@ARGS);
}
pmichaud@kiwi:~/p6/nqp$ ./nqp eek.nqp -e 'eek'
QAST::Compiler requires QAST::CompUnit node at root of compile tree (got QAST::IVal)
current instr.: 'post' pc 39106 (src/stage2/QAST.pir:13692) (src/stage2/QAST.nqp:2069)
called from Sub 'post' pc 33147 (src/stage2/gen/NQPHLL.pir:12660) (src/stage2/gen/NQPHLL.pm:1493)
called from Sub '' pc 32381 (src/stage2/gen/NQPHLL.pir:12356) (src/stage2/gen/NQPHLL.pm:1442)
called from Sub 'compile' pc 32290 (src/stage2/gen/NQPHLL.pir:12316) (src/stage2/gen/NQPHLL.pm:1440)
called from Sub 'eval' pc 29227 (src/stage2/gen/NQPHLL.pir:11071) (src/stage2/gen/NQPHLL.pm:1211)
called from Sub '' pc 30812 (src/stage2/gen/NQPHLL.pir:11734) (src/stage2/gen/NQPHLL.pm:1327)
called from Sub 'command_eval' pc 30711 (src/stage2/gen/NQPHLL.pir:11694) (src/stage2/gen/NQPHLL.pm:1359)
called from Sub 'command_line' pc 30013 (src/stage2/gen/NQPHLL.pir:11433) (src/stage2/gen/NQPHLL.pm:1309)
called from Sub 'MAIN' pc 288 ((file unknown):112596869) (eek.nqp:27)
called from Sub '' pc 148 ((file unknown):112596820) (eek.nqp:1)
called from Sub '' pc 29439 (src/stage2/gen/NQPHLL.pir:11153) (src/stage2/gen/NQPHLL.pm:1224)
called from Sub 'eval' pc 29291 (src/stage2/gen/NQPHLL.pir:11092) (src/stage2/gen/NQPHLL.pm:1211)
called from Sub 'evalfiles' pc 31756 (src/stage2/gen/NQPHLL.pir:12102) (src/stage2/gen/NQPHLL.pm:1424)
called from Sub 'command_eval' pc 30471 (src/stage2/gen/NQPHLL.pir:11602) (src/stage2/gen/NQPHLL.pm:1334)
called from Sub 'command_line' pc 30013 (src/stage2/gen/NQPHLL.pir:11433) (src/stage2/gen/NQPHLL.pm:1309)
called from Sub 'MAIN' pc 760 (src/stage2/gen/NQP.pir:250) (src/stage2/gen/NQP.pm:3085)
called from Sub '' pc 443 (src/stage2/gen/NQP.pir:155) (src/stage2/gen/NQP.pm:1475)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment