Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
As promised, the operator precedence table is now defined in the
Browse files Browse the repository at this point in the history
grammar instead of the actions.
  • Loading branch information
pmichaud committed Oct 30, 2009
1 parent ee72079 commit 646acb7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/NQP/Actions.pm
Expand Up @@ -4,21 +4,6 @@ our @BLOCK;

sub INIT() {
our @BLOCK := Q:PIR { %r = new ['ResizablePMCArray'] };
# These will eventually go in NQP::Grammar.
NQP::Grammar.O(':prec<y=>, :assoc<unary>', '%methodop');
NQP::Grammar.O(':prec<x=>, :assoc<unary>', '%autoincrement');
NQP::Grammar.O(':prec<w=>, :assoc<left>', '%exponentiation');
NQP::Grammar.O(':prec<v=>, :assoc<unary>', '%symbolic_unary');
NQP::Grammar.O(':prec<u=>, :assoc<left>', '%multiplicative');
NQP::Grammar.O(':prec<t=>, :assoc<left>', '%additive');
NQP::Grammar.O(':prec<r=>, :assoc<left>', '%concatenation');
NQP::Grammar.O(':prec<m=>, :assoc<left>', '%relational');
NQP::Grammar.O(':prec<l=>, :assoc<left>', '%tight_and');
NQP::Grammar.O(':prec<k=>, :assoc<left>', '%tight_or');
NQP::Grammar.O(':prec<j=>, :assoc<right>', '%conditional');
NQP::Grammar.O(':prec<i=>, :assoc<right>', '%assignment');
NQP::Grammar.O(':prec<g=>, :assoc<list>, :nextterm<nulltermish>', '%comma');
NQP::Grammar.O(':prec<f=>, :assoc<list>', '%list_infix');
}
sub xblock_immediate($xblock) {
Expand Down
18 changes: 18 additions & 0 deletions src/NQP/Grammar.pm
Expand Up @@ -298,6 +298,24 @@ token circumfix:sym<{ }> { <?[{]> <pblock> }

## Operators

INIT {
NQP::Grammar.O(':prec<y=>, :assoc<unary>', '%methodop');
NQP::Grammar.O(':prec<x=>, :assoc<unary>', '%autoincrement');
NQP::Grammar.O(':prec<w=>, :assoc<left>', '%exponentiation');
NQP::Grammar.O(':prec<v=>, :assoc<unary>', '%symbolic_unary');
NQP::Grammar.O(':prec<u=>, :assoc<left>', '%multiplicative');
NQP::Grammar.O(':prec<t=>, :assoc<left>', '%additive');
NQP::Grammar.O(':prec<r=>, :assoc<left>', '%concatenation');
NQP::Grammar.O(':prec<m=>, :assoc<left>', '%relational');
NQP::Grammar.O(':prec<l=>, :assoc<left>', '%tight_and');
NQP::Grammar.O(':prec<k=>, :assoc<left>', '%tight_or');
NQP::Grammar.O(':prec<j=>, :assoc<right>', '%conditional');
NQP::Grammar.O(':prec<i=>, :assoc<right>', '%assignment');
NQP::Grammar.O(':prec<g=>, :assoc<list>, :nextterm<nulltermish>', '%comma');
NQP::Grammar.O(':prec<f=>, :assoc<list>', '%list_infix');
}


token nulltermish {
| <OPER=term=termish>
| <?>
Expand Down

0 comments on commit 646acb7

Please sign in to comment.