Skip to content

Instantly share code, notes, and snippets.

@ShimmerFairy
Created May 22, 2020 13:16
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 ShimmerFairy/ffd0c5f5f42a85c02980544e552a67a5 to your computer and use it in GitHub Desktop.
Save ShimmerFairy/ffd0c5f5f42a85c02980544e552a67a5 to your computer and use it in GitHub Desktop.
Failing minimal NQP Compiler example
use NQPHLL;
grammar A::Grammar is HLL::Grammar {
token TOP { . }
}
class A::Actions is HLL::Actions {
method TOP($/) {
make QAST::Block.new(
QAST::Stmts.new(
:node($/),
QAST::Op.new(
:op('say'),
QAST::SVal.new(
:value($/.Str)))));
}
}
class A::Compiler is HLL::Compiler {
}
sub MAIN(*@ARGS) {
my $c := A::Compiler.new();
$c.language('A');
$c.parsegrammar(A::Grammar);
$c.parseactions(A::Actions);
$c.command_line(@ARGS, :encoding('utf8'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment