Parse an odin model, returning an intermediate representation.
The `odin_parse_`

version is a "standard evaluation" escape
hatch.

```
odin_parse(x, type = NULL, options = NULL)
odin_parse_(x, options = NULL, type = NULL)
```

- x
An expression, character vector or filename with the odin code

- type
An optional string indicating the the type of input - must be one of

`expression`

,`file`

or`text`

if provided. This skips the type detection code used by odin and makes validating user input easier.- options
odin options; see odin_options. The primary options that affect the parse stage are

`validate`

and`pretty`

.

A schema for the intermediate representation is available in the
package as `schema.json`

. It is subject to change at this
point.

odin_validate, which wraps this function where parsing might fail, and odin_build for building odin models from an intermediate representation.

```
# Parse a model of exponential decay
ir <- odin::odin_parse({
deriv(y) <- -0.5 * y
initial(y) <- 1
})
# This is odin's intermediate representation of the model
ir
#> {"version":"1.3.6","config":{"base":"odin","include":null,"custom":null},"meta":{"internal":"internal","user":"user","state":"state","result":"dstatedt","output":"output","time":"t","initial_time":"initial_t"},"features":{"continuous":true,"discrete":false,"mixed":false,"has_array":false,"has_output":false,"has_user":false,"has_delay":false,"has_interpolate":false,"has_stochastic":false,"has_include":false,"initial_time_dependent":false},"data":{"elements":[{"name":"initial_y","location":"internal","storage_type":"double","rank":0,"dimnames":null,"stage":"constant"},{"name":"y","location":"variable","storage_type":"double","rank":0,"dimnames":null,"stage":"time"}],"variable":{"length":1,"contents":[{"name":"y","offset":0,"initial":"initial_y"}]},"output":{"length":0,"contents":[]}},"equations":[{"name":"deriv_y","type":"expression_scalar","source":[1],"depends":{"functions":["*","-"],"variables":["y"]},"lhs":"y","rhs":{"value":["*",["-",0.5],"y"]}},{"name":"initial_y","type":"expression_scalar","source":[2],"depends":null,"lhs":"initial_y","rhs":{"value":1}}],"components":{"create":{"variables":[],"equations":["initial_y"]},"user":{"variables":[],"equations":[]},"initial":{"variables":[],"equations":[]},"rhs":{"variables":["y"],"equations":["deriv_y"]},"update_stochastic":{"variables":[],"equations":[]},"output":{"variables":[],"equations":[]}},"user":[],"interpolate":{"min":[],"max":[],"critical":[]},"source":["deriv(y) <- -0.5 * y","initial(y) <- 1"]}
# If parsing odin models programmatically, it is better to use
# odin_parse_; construct the model as a string, from a file, or as a
# quoted expression:
code <- quote({
deriv(y) <- -0.5 * y
initial(y) <- 1
})
odin::odin_parse_(code)
#> {"version":"1.3.6","config":{"base":"odin","include":null,"custom":null},"meta":{"internal":"internal","user":"user","state":"state","result":"dstatedt","output":"output","time":"t","initial_time":"initial_t"},"features":{"continuous":true,"discrete":false,"mixed":false,"has_array":false,"has_output":false,"has_user":false,"has_delay":false,"has_interpolate":false,"has_stochastic":false,"has_include":false,"initial_time_dependent":false},"data":{"elements":[{"name":"initial_y","location":"internal","storage_type":"double","rank":0,"dimnames":null,"stage":"constant"},{"name":"y","location":"variable","storage_type":"double","rank":0,"dimnames":null,"stage":"time"}],"variable":{"length":1,"contents":[{"name":"y","offset":0,"initial":"initial_y"}]},"output":{"length":0,"contents":[]}},"equations":[{"name":"deriv_y","type":"expression_scalar","source":[1],"depends":{"functions":["*","-"],"variables":["y"]},"lhs":"y","rhs":{"value":["*",["-",0.5],"y"]}},{"name":"initial_y","type":"expression_scalar","source":[2],"depends":null,"lhs":"initial_y","rhs":{"value":1}}],"components":{"create":{"variables":[],"equations":["initial_y"]},"user":{"variables":[],"equations":[]},"initial":{"variables":[],"equations":[]},"rhs":{"variables":["y"],"equations":["deriv_y"]},"update_stochastic":{"variables":[],"equations":[]},"output":{"variables":[],"equations":[]}},"user":[],"interpolate":{"min":[],"max":[],"critical":[]},"source":["deriv(y) <- -0.5 * y","initial(y) <- 1"]}
```