Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/Expression.atg @ 19289:62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 03 Feb 2015 15:07:07 +0100 |
parents | 08aa0372dad4 |
children | 65d29fa81397 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/Expression.atg Mon Dec 29 18:32:03 2014 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/Expression.atg Tue Feb 03 15:07:07 2015 +0100 @@ -31,9 +31,9 @@ CHARACTERS -letter = 'A'..'Z' + 'a'..'z'. +letter = 'A' .. 'Z' + 'a' .. 'z' + '_' + '$'. nonZeroDigit = "123456789". -digit = "0123456789". +digit = '0' + nonZeroDigit . TOKENS @@ -47,25 +47,35 @@ Expression<out DSLExpression result> = +LogicFactor<out result> +. + + +LogicFactor<out DSLExpression result> += +ComparisonFactor<out result> +[ + ("||") (. Token op = t; .) + ComparisonFactor<out DSLExpression right> (. result = new Binary(op.val, result, right); .) +] +. + +ComparisonFactor<out DSLExpression result> += NegateFactor<out result> +[ + ("<" | "<=" | ">" | ">=" | "==" | "!=" ) (. Token op = t; .) + NegateFactor<out DSLExpression right> (. result = new Binary(op.val, result, right); .) +] . + NegateFactor<out DSLExpression result> = (. boolean negated = false; .) [ "!" (. negated = true; .) ] - LogicFactor<out result> (. result = negated ? new Negate(result) : result;.) -. - - -LogicFactor<out DSLExpression result> -= -Factor<out result> -[ - ("<" | "<=" | ">" | ">=" | "==" | "!=" ) (. Token op = t; .) - Factor<out DSLExpression right> (. result = new Binary(op.val, result, right); .) -] + Factor<out result> (. result = negated ? new Negate(result) : result;.) .