Created
September 26, 2017 23:33
-
-
Save skids/5b2422af6935188cef9f3331e754ad87 to your computer and use it in GitHub Desktop.
NQP slang skeleton for Pel6 devs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment