package
0.0.0-20220930082050-67fbc49d198a
Repository: https://github.com/akyoto/q.git
Documentation: pkg.go.dev

# README

expression

This package parses an expression in Q. It supports mathematical operators as well as function calls like sum(3, 4) + 5.

An expression consists of a token (either an operator or the leaf token like numbers and identifiers). Operators and function calls have child expressions. Operators use the child expressions as operands while function calls use them as parameters for the call.

Function call nodes have the boolean IsFunctionCall set to true.

Examples

1 + 2

  +
 / \
1   2

sum(1, 2)

  sum
 /   \
1     2

1 + 2 * 3

  +
 / \
1   *
   / \
  2   3