# parser() Function & Examples

Use the parser() expression function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## parser

#### parser()

Try it yourself:

```calculio
myParser = parser()
myParser.evaluate("sqrt(3^2 + 4^2)")
myParser.set("x", 3)
myParser.evaluate("y = x + 3")
myParser.evaluate(["y = x + 3", "y = y + 1"])
myParser.get("y")
```

[parse](https://calcul.io/function/parse/index.md)

[compile](https://calcul.io/function/compile/index.md)

---

## parser(): create an expression environment

**parser()** creates a parser context for evaluating expressions and keeping assigned variables together. It is useful for a sequence of formulas that share definitions.

## Stateful calculations

In a parser context, define a name once and reuse it in later expressions. This is more convenient than repeatedly supplying the same scope, but it also means assignments can affect later results.

## Related tools

Use [parse()](https://calcul.io/function/parse/index.md) for a single text expression, [evaluate()](https://calcul.io/function/evaluate/index.md) to calculate it, and [simplify()](https://calcul.io/function/simplify/index.md) for symbolic cleanup. [clone()](https://calcul.io/function/clone/index.md) helps preserve a value before changing a workflow.

## Caveat

Keep contexts separate when calculations must be reproducible and avoid evaluating untrusted code-like text.

[All functions](https://calcul.io/functions/index.md)
