---
- S
-
- S
-
- S
- a
-
- S
This file contains hidden or 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 Carp::Always; | |
| use Marpa::R2 2.090; # for parse(), it's cool | |
| my $g = Marpa::R2::Scanless::G->new( { | |
| source => \(<<'END_OF_SOURCE'), |
This file contains hidden or 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 Marpa::R2 2.090; # for parse() | |
| my $g = Marpa::R2::Scanless::G->new( { | |
| source => \(<<'END_OF_SOURCE'), | |
| :default ::= action => [ name, value] | |
| lexeme default = action => [ name, value] latm => 1 |
This file contains hidden or 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
| input : <[/] Trading 10mm ABC 2.5 19 05/06 mkt can use 50mm> | |
| extracted: <ABC 2.5 19> | |
| input : <XYZ 6.5 15 10-2B 106-107 B3 AAA- 1.646MM 2x2> | |
| extracted: <XYZ 6.5 15> |
This file contains hidden or 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
| 1: | |
| Input: <"String"> | |
| Output: --- | |
| - | |
| - '"' | |
| - | |
| - string_token | |
| - String | |
| - '"' |
This file contains hidden or 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 Test::More; | |
| use Marpa::R2; | |
| my $dsl = <<'END_OF_SOURCE'; |
This file contains hidden or 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
| 0-25 R : Time flies like an arrow. <- S ::= NP VP period | |
| 0- 4 R : Time <- NP ::= NN | |
| # token | |
| 0- 4 T : Time <- NN | |
| # glade 0- 4: Time --- | |
| - (NP (NN Time)) | |
| 5-24 R : flies like an arrow <- VP ::= VBZ PP | |
| # token | |
| 5-10 T : flies <- VBZ |
This file contains hidden or 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; | |
| # Adapted from balanced parens example in | |
| # http://marvin.cs.uidaho.edu/Teaching/CS445/grammar.html | |
| use Marpa::R2; | |
| use YAML; |
This file contains hidden or 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; | |
| $Data::Dumper::Indent = 0; | |
| $Data::Dumper::Terse = 1; | |
| use Carp::Always; # force stack trace |
This file contains hidden or 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 Marpa::R2; | |
| my $g = Marpa::R2::Scanless::G->new( { | |
| source => \(<<'END_OF_SOURCE'), | |
| :default ::= action => [ value] | |
| lexeme default = action => [ value] latm => 1 |