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
#!perl | |
use Marpa::R2; | |
print "\$Marpa::R2::VERSION = $Marpa::R2::VERSION\n"; | |
my $g = Marpa::R2::Scanless::G->new({source => \do {local $/; <DATA>}}); | |
my $r = Marpa::R2::Scanless::R->new({grammar => $g}); | |
my $input = 'anything'; | |
$r->read(\$input); | |
$r->value; |
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
#!env perl | |
use strict; | |
use diagnostics; | |
use Marpa::R2 2.081001; | |
my $grammar = Marpa::R2::Scanless::G->new({ source => \do {local $/; <DATA>}}); | |
my $fmt = "%5s %-20s %-20s %s\n"; | |
printf $fmt, 'depth', 'ruleName', 'lhsName', 'rhsNames'; | |
foreach (@{rulesByDepth($grammar)}) { | |
printf $fmt, $_->{depth}, $_->{ruleName}, $_->{lhsName}, join(' ', @{$_->{rhsNames}}); |
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
#!env perl | |
# ----------------------------------------------------------------------------------------- | |
# Marpa grammar for EBNF published by ISO/IEC 14977:1996(E) | |
# | |
# Extensions are minor, and ONLY because our keyboards are more likely to expose Latin-1 | |
# character rather than the Windows-1252 characters as per the spec, i.e.: | |
# | |
# Extension 1: Add ' to quoted strings (ISO published the special neighbour character ’) | |
# Extension 2: Add ^ to <other character> (ISO published the special neighbour character ˆ) | |
# Extension 3: Add ` to <other character> (ISO published the special neighbour character ‘) |
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
inaccessible is ok by default | |
:start ::= document | |
AttDef ::= S Name S AttType S DefaultDecl | |
AttDef_any ::= AttDef * | |
AttType ::= StringType | |
AttType ::= TokenizedType | |
AttType ::= EnumeratedType | |
AttValue ::= _Lex030 _Gen060_any _Lex030 | |
AttValue ::= _Lex032 _Gen063_any _Lex032 |
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
#!env perl | |
package w3c::org::dom { | |
use Moose::Role; | |
use MRO::Compat; | |
use namespace::sweep; | |
use MooseX::Types::Moose qw/ArrayRef/; | |
use MooseX::Types -declare => [ | |
qw/ | |
Attr |
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
use 5.010; | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use Marpa::R2; | |
my $g = Marpa::R2::Scanless::G->new( { | |
bless_package => 'main', |
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
/**************************/ | |
/* _xml_1_0_parseEventsb */ | |
/**************************/ | |
static C_INLINE marpaWrapperBool_t _xml_1_0_parseEventsb(void *datavp, marpaWrapper_t *marpaWrapperp, size_t nEventi, marpaWrapperEvent_t *marpaWrapperEventp) { | |
marpaWrapperBool_t rcb = MARPAWRAPPER_BOOL_TRUE; | |
xml_1_0_t *xml_1_0p; | |
marpaXmlLog_t *marpaXmlLogp = NULL; | |
xml_1_0_symbol_t symboli; | |
int i; |
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
#!env perl | |
use strict; | |
use diagnostics; | |
use Marpa::R2; | |
use Data::Dumper; | |
use POSIX qw/EXIT_SUCCESS/; | |
use Data::Section -setup; | |
use open qw(:std :utf8); # Undeclared streams in UTF-8. | |
# |
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
#!env sh -v | |
# | |
# Marpa in Lua proof of concept - Assumption: Debian/Linux | |
# | |
# Prologue: apt-get -t unstable install lua5.1 liblua5.1-dev swig | |
# | |
# Please go to Marpa-R2-2.096000/engine/read_only and execute this file | |
# --------------------------------------------------------------------- | |
# | |
[ -r ./Makefile ] && make distclean |
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
:default ::= action => [values] bless => ::lhs | |
lexeme default = action => [start,length,value,name] | |
:start ::= ClassFile | |
ClassFile ::= | |
magic | |
minor_version | |
major_version | |
constant_pool_count | |
constant_pools |