diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-06-21 20:21:21 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-06-21 20:21:21 (GMT) |
commit | fd4d09aafba1eb096cf9be4e93250087d9af465e (patch) | |
tree | de86d46a2bdc2556d5684d58fc2def1889575d8c /taccle/examples/infix_calc.tac | |
parent | 6919da64f1e15c1b0a350bb318772d05d2efe9d3 (diff) | |
download | blt-fd4d09aafba1eb096cf9be4e93250087d9af465e.zip blt-fd4d09aafba1eb096cf9be4e93250087d9af465e.tar.gz blt-fd4d09aafba1eb096cf9be4e93250087d9af465e.tar.bz2 |
update taccle
Diffstat (limited to 'taccle/examples/infix_calc.tac')
-rw-r--r-- | taccle/examples/infix_calc.tac | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/taccle/examples/infix_calc.tac b/taccle/examples/infix_calc.tac deleted file mode 100644 index 95ef2ee..0000000 --- a/taccle/examples/infix_calc.tac +++ /dev/null @@ -1,35 +0,0 @@ -# $Id: infix_calc.tac,v 1.1 2004/09/29 16:23:28 tang Exp $ - -# This example demonstrates how taccle handles operator precedence. -# The code is shamelessly borrowed from the GNU Bison info manual. - -# taccle Declarations -%token ID NEWLINE -%left '-' '+' -%left '*' '/' -%left NEG # negation--unary minus -%right '^' # exponentiation - -# Grammar follows -%% -input: # empty string - | input line -; - -line: NEWLINE - | exp NEWLINE { puts [format "\t%.10g" $1] } -; - -exp: ID { set _ $1 } - | exp '+' exp { set _ [expr {$1 + $3}] } - | exp '-' exp { set _ [expr {$1 - $3}] } - | exp '*' exp { set _ [expr {$1 * $3}] } - | exp '/' exp { set _ [expr {$1 / $3}] } - | '-' exp %prec NEG { set _ [expr {-1.0 * $2}] } - | exp '^' exp { set _ [expr {pow($1, $3)}] } - | '(' exp ')' { set _ $2 } -; -%% - -source simple_scanner.tcl -yyparse |