Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Perl 6 standard grammar

branch: master
Octocat-spinner-32 boot rebootstrap October 16, 2012
Octocat-spinner-32 inc [STD] prefix LazyMap and Actions with an STD:: prefix July 29, 2010
Octocat-spinner-32 lib catch up standard with s/done_testing/done/ January 12, 2011
Octocat-spinner-32 std_hilite add a utf-8 signifier to the std_hilite script January 07, 2011
Octocat-spinner-32 tools fix to catch links to children of the '.' member October 17, 2010
Octocat-spinner-32 .gitignore added a .gitignore to src/perl6 July 14, 2009
Octocat-spinner-32 suppress missing action package warnings September 01, 2012
Octocat-spinner-32 CORE.setting more missing names May 04, 2013
Octocat-spinner-32 CORE5.setting add CORE5.setting September 15, 2012
Octocat-spinner-32 Cursor.pm6 [STD,Cursor] Push error reporting functions down into the new Perl6 C… June 04, 2010
Octocat-spinner-32 CursorBase.pm6 [Cursor] Rewrite in Perl 6, bring under bootstrap control June 04, 2010
Octocat-spinner-32 CursorBase.pmc disallow all null and whitespacey ops November 17, 2012
Octocat-spinner-32 DEBUG.pmc [STD,et al.] add explicit copyright notices at suggestion of diakopter++ February 06, 2010
Octocat-spinner-32 [STD] Document LazyMap better May 20, 2010
Octocat-spinner-32 Makefile setup to recompile CORE5 setting September 10, 2012
Octocat-spinner-32 NAME.pmc [STDeco] start transitioning to {*} proto stubs July 11, 2010
Octocat-spinner-32 README Fix typos November 20, 2010
Octocat-spinner-32 RE_ast.pmc [Cursor] Re-special-case \r in \h; Perl/Blank doesn't cover it after all June 24, 2010
Octocat-spinner-32 [STD] better error message when loading STD withought having run make June 30, 2010
Octocat-spinner-32 STD.pm6 Fix heredocs that contain a quote's standard starter April 19, 2014
Octocat-spinner-32 STD_P5.pm6 allow: require VERSION May 14, 2013
Octocat-spinner-32 Stash.pmc [STD,et al.] add explicit copyright notices at suggestion of diakopter++ February 06, 2010
Octocat-spinner-32 dist.ini Reboot and fix viv February 10, 2011
Octocat-spinner-32 [STD] various changes in preparation for inlining p5 regex optimizations August 15, 2008
Octocat-spinner-32 uniprops [Cursor] Following a so-simple-I-feel-stupid suggestion from pmurias+… June 18, 2010
Octocat-spinner-32 viv remove LASTSTATE hack October 16, 2012
=head1 Perl 6 Parser Stuff in the Pugs Repo

Welcome to pugs/src/perl6.  This is the home of STD.pm6, the canonical
Perl 6 grammar, which is written in Perl 6 (of course).  It is also the
home of viv, a retargettable Perl 6 metacompiler which can translate
STD.pm6 into Perl 5 (and eventually other things).  The metacompiler
relies on STD.pm6 to parse itself, requiring a stored bootstrap version
of the compiled  This is also the home of Cursor, the canonical
implementation of the Perl 6 rules engine; it co-evolves with viv and
executes the actual rules.  This is also the home of a collection of
minor tools used in the development of STD.pm6 and viv.

=head1 Prerequisites

You'll need the following Perl bits to run stuff:

* Perl 5.10.0 or later in PATH

* YAML::XS       (e.g. sudo apt-get install libyaml-libyaml-perl)

* Moose          (e.g. sudo apt-get install libmoose-perl)

* File::ShareDir

=head1 Running Stuff

You can get started by using the Makefile command, C<make>.  This will convert
the Perl 6 grammar into a Perl 5 module, C<STD>.  C<STD> has a fairly simple
API; just call C<parse> as a class method with the source you want to parse as
a parameter, and look at the result.  Another module, C<Actions>, is provided
which converts C<STD>'s output into a more object-oriented form; see C<viv>'s
source for an example of the latter's use.  (Both methods have more options
when you need them.)

The following tools are provided which leverage the power of C<STD>:

* C<tryfile> parses a file of Perl 6 code and reports 'ok' or 'FAILED', plus the
  time taken and memory used.

* C<std> does the same, but also tests Actions.

* C<redspans> parses a file, reporting what rules matched which tokens.

* C<reds> appears to be an older, non-working version of redspans.

* C<teststd> uses STD to check the syntax of the Perl 6 Specification Tests.

* C<tloop> is an interactive STD syntax checker.

* C<vill> is a prototype STD-based LLVM-based Perl 6 JIT compiler.

* C<viv> is a retargettable metacompiler for the static subset of Perl 6.

* C<std_hilite/STD_syntax_highlight> is a syntax highlighter with multiple output formats.

See the headers of the respective programs for more details, and don't hesitate
to ask around as quite a bit of this is underdocumented.

=head1 Working the Makefile

To regenerate perl 5 files from perl 6 STD.pm6, STD_P5.pm6, and Cursor.pm6


To do that, but without running the self test (bootstrap):

 make fast

To remake only one file:

 make STD.pmc

To update the first stage, allowing new STD.pm6 or Cursor.pm6 features to be
used while building future versions of STD.pm6 or Cursor.pm6:

 make reboot

To remove all generated files:

 make clean

To test the ability to parse the Perl 6 test suite (this is a very effective
regression test, but B<slow> - 20-75 minutes; also, it runs in a snapshot of
the current directory, so you can continue hacking):

 make snaptest

Something went wrong with that request. Please try again.