6 Commits

Author SHA1 Message Date
James Eversole
63504ba939 Rough draft of modules
This includes a naive implementation of a module system where imported
files have their imports recursively handled, strips the module/import
AST nodes, and then evals everything into a flat environment using
namespace prefixes like "Module.function".
2025-01-27 12:24:30 -06:00
James Eversole
918d929c09 # File eval mode now relies on main function
To encourage organizing code in a way that helps in understanding, I
have implemented the common idiom of requiring a `main` function. In
tricu and other functional languages, it is usually placed near the top
of the module. The evaluator gracefully handles the situation of passing
multiple files where the intermediary "library" files do not have main functions.
2025-01-26 15:33:12 -06:00
James Eversole
a64b3f0829 Definition dependency analysis
tricu now allows defining terms in any order and will resolve
dependencies to ensure that they're evaluated in the right order.
Undefined terms are detected and throw errors during dependency
ordering.
For now we can't define top-level mutually recursive terms.
2025-01-26 14:50:39 -06:00
James Eversole
e2621bc09d Allow lambda expressions without explicit paren 2025-01-26 08:52:28 -06:00
James Eversole
2bd388c871 Eval optimization! Tests for demos 2025-01-25 09:18:13 -06:00
James Eversole
8b043911ca Add size demo 2025-01-23 18:57:59 -06:00