Skip to content
skids edited this page Sep 29, 2017 · 1 revision
# This file is for developers wishing to quickly test
# modifications to Perl6's internal grammars/actions.
#
# Just copy the rules/actions you want to play with from
# src/Perl6/Grammar.nqp and src/Perl6/Actions.nqp
# into the appropriate class below.
#
# Every time you modify, execute (assuming you have it in /tmp/):
# "nqp --target=mbc --output=/tmp/nqpslang.moarvm --encoding=utf8 /tmp/nqpslang.nqp"
#
# Then you can test CLI code with:
# NQP_LIB=/tmp/ PERL6LIB=/tmp/ perl6 --ll-exception -e 'use nqpslang:from<NQP>; ...'

use nqp;
use NQPHLL;
use nqpmo;
use MASTOps;
use MASTNodes;
use QAST;
use QRegex;
use NQPP6QRegex;
use NQPP5QRegex;
use Perl6::ModuleLoader;
use Perl6::Grammar;
use Perl6::Actions;
use Perl6::World;
use Perl6::Pod;
use Perl6::Compiler;
use Perl6::DebugPod;
use Perl6::Metamodel;
use Perl6::Ops;
use Perl6::Optimizer;

grammar lang is Perl6::Grammar {

}

class lang-actions is Perl6::Actions {

}

grammar qu is Perl6::QGrammar {

}

class qu-actions is Perl6::QActions {

}

grammar rx is Perl6::RegexGrammar {

}

class rx-actions is Perl6::RegexActions {

}

grammar rx5 is Perl6::P5RegexGrammar {

}

class rx5-actions is Perl6::P5RegexActions {

}

$*LANG.define_slang('MAIN', lang, lang-actions);
$*LANG.define_slang('Quote', qu, qu-actions);
$*LANG.define_slang('Regex', rx, rx-actions);
$*LANG.define_slang('P5Regex', rx5, rx5-actions);