Hello,
I have created a file called SalesReport.mp6, which contains a grammar
-------------------------------------------------
module SalesReport;
grammar SalesExportGram is export {
token TOP { ^ <country>+ $ }
token country {
<name> \n
<destination>+
}
token destination {
\t <name> \s+ ':' \s+
<lat=.num> ',' <long=.num> \s+ ':'\s+
<sales=.integer> \n
}
token name { \w+ [ \s \w+ ]* }
token num { '-'? \d+ [\. \d+]? }
token integer { '-'? \d+ }
}
------------------------------------------------
which I would like to use in the following PERL 6 script:
use v6;
use lib '.';
use SalesReport;
my $parsed = SalesReportGram.parsefile('sales_report.txt');
if $parsed {
my @countries = @($parsed<country>);
...
Unfortunately, when I run the script, I get an "undeclared name:
SalesReportGram" error.
I have tried
my $parsed = SalesReport::SalesReportGram.parsefile('sales_report.txt');
and
my $parsed = SalesReport.SalesReportGram.parsefile('sales_report.txt');
but to no avail.
Any suggestions?
Many thanks.
Philippe