Dynspec.jl
Dynspec.jl is under active initial development. APIs, syntax representations, and internal interfaces are experimental and subject to breaking changes. Follow progress, report issues, and contribute on GitHub (EconForge/dynspec.jl).
A concise, type-stable Julia package for reading, interpreting, and analyzing dynamic economic model specifications, replicating and extending the dynspec engine of dyno.
Core Principles
- Unified
AbstractModelBlockArchitecture: Models are represented byModelBlock <: AbstractModelBlock, holding a calibrated type-stableContext, an iterable collection ofEquations, metadata, and the complete preserved grammar parse tree (Tree). - Behavioral Interface: A model block is defined by its ability to evaluate
residualsand analyticaljacobian/derivatives, rather than merely being a vector of equations. - Preserved Parse Tree: The full AST is preserved on both the block and individual equations. This avoids re-lexing or re-parsing when calibrating parameters, running variant sweeps, or targeting alternate symbolic backends.
- Decoupled Equation Filtering (
filter_by): Residual and derivative evaluations acceptfilter_byto filter equations by block tags (:transition,:arbitrage, etc.) or custom predicates. - Exact Analytical Differentiation via ForwardDiff: Computes exact machine-precision derivatives using
ForwardDiff.Dualnumbers without slow symbolic engines or custom derivative dictionaries. - Clean, Predictable Context: Model contexts hold typed dictionaries (
constants,steady_states,processes,values), providing unambiguous, explicit access (context.constants[:α]) and avoiding namespace collisions.
Quick Installation
using Pkg
Pkg.add(url="https://github.com/EconForge/dynspec.jl")See the Function & Option Guide for a comprehensive demonstration of all package functions and options.