# 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
# 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)
Run the code above in your browser using DataLab