expression : logical_expr /^\$/ { \$return = \$item[1]; } logical_expr : comparison_expr logical_op logical_expr { [ \$item[2][0], \$item[2][1], \$item[1], \$item[3] ] } | comparison_expr { \$item[1] } comparison_expr : math_expr comparison_op comparison_expr { [ \$item[2][0], \$item[2][1], \$item[1], \$item[3] ] } | math_expr { \$item[1] } math_expr : paren_expr math_op math_expr { [ \$item[2][0], \$item[2][1], \$item[1], \$item[3] ] } | paren_expr { \$item[1] } paren_expr : '(' logical_expr ')' { \$item[2] } | atom logical_op : /\\|\\||or|&&|and/ { [ ${\BIN_OP}, \$item[1] ] } comparison_op : /le|ge|eq|ne|lt|gt/ { [ ${\BIN_OP}, \$item[1] ] } | />=?|<=?|!=|==/ { [ ${\BIN_OP}, \$item[1] ] } math_op : /[-+*\\/\%]/ { [ ${\BIN_OP}, \$item[1] ] } atom : function_call | var | literal function_call : function_name '(' args ')' { [ ${\FUNCTION_CALL}, \$item[1], \$item[3] ] } | function_name ...'(' logical_expr { [ ${\FUNCTION_CALL}, \$item[1], [ \$item[3] ] ] } | function_name '(' ')' { [ ${\FUNCTION_CALL}, \$item[1] ] } function_name : /[A-Za-z_][A-Za-z0-9_]*/ { \$item[1] } args : var : /[A-Za-z_][A-Za-z0-9_]*/ { \\\$item[1] } literal : /-?\\d*\\.\\d+/ { \$item[1] } | /-?\\d+/ { \$item[1] } | { \$item[1][2] }