Skip to content

Parse parse

Parses a string into an expression without evaluating it.

;; Parse a simple expression
 (parse "(+ 1 2)")
(
  +
  1
  2
)

;; Parse a function definition
 (parse "(fn [x] (* x 2))")
@(null)

;; Parse multiple expressions
 (parse "(set x 10) (+ x 20)")
(
  do
  (set x 10)
  (+ x 20)
)

Syntax

(parse str)
- str: String to parse

Warning

  • Input must be a string
  • Returns parsed expression without evaluating
  • Useful for inspecting code structure