2

The simplest grammar usage gives me complation error.

use v6;
grammar Foo {
   token bar { \w+ }
}
say 'abc' ~~ /<Foo::bar>/;

Invoked like src/rakudo/perl6 simple.p6, it fails with

regex assertion not terminated by angle bracket at line 7, near "::bar>/;\n"
...

I tried a number of known-to-work examples with similar results, so I suspect that my perl6 setup is incorrect.

If you use grammar with perl6, please show me your setup. Thanks in advance.

Elizabeth Mattijsen
  • 25,654
  • 3
  • 75
  • 105
tengu
  • 41
  • 3

2 Answers2

3

I'm sorry; your error message contains two clues (line 7, ::bar) that the code you've pasted is not enough to diagnose your problem. There's just not enough information to understand your problem.

Apart from that, you have a mismatched closing parenthesis in the last line of the code you did post, and you haven't declared the <Foo::bar>.

I don't think your Perl 6 setup is incorrect, for what it's worth. There's nothing in what you've written to indicate that.

Christopher Bottoms
  • 11,218
  • 8
  • 50
  • 99
Carl Mäsak
  • 379
  • 2
  • 5
  • Thanks for pointing out the syntax error with the example. I have updated the code. Going back to (#25 "Minneapolis") from snapshot from February fixed the error. The above code now runs: rakudo-2010-01/parrot_install/bin/perl6 simple.p6 abc Thanks for your hard work on perl6 and I am looking forward to using it. – tengu Mar 06 '10 at 20:18
2

Rakudo 2010.02 release (#26 "Amsterdam") has a regression that breaks module import. Use Rakudo 2010-01 release (#25 "Minneapolis") instead. download page is here: http://github.com/rakudo/rakudo/downloads

tengu
  • 41
  • 3