Click here to Skip to main content
13,191,642 members (65,859 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
#!/usr/bin/perl -w
use RecDescent;
my $grammar=q
{
startrule: expr eofile {$return=exp
}



SELECTION'`['condlist`]'`('exp`)'
| `PROJECTION'`[`attrlist']'`('exp`)


projection: '#'='PROJECT'


attrlist : attribute | attribute `,' attrlist;
condlist : condlist `OR' condlist

| condlist `AND' condlist
| `NOT' condlist
| `('condlist`)'
| compared comp compared
;
comp : `<>' | `!=' | `=' | `=='
| `>=' | `<=' | `<' | `>';
compared : attribute | data;


my parser=new Parse::RecDescent($exp) or die "parser gen failed";
my @exp=(#[cashierID](cashiers));
foreach my $exp(@exp) {
print $exp.(defined($parser->startrule($exp)) . \n";


}
}
Posted 26-Aug-14 23:16pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.171017.2 | Last Updated 27 Aug 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100