Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| creating:operators [2025/06/13 21:25] – Removed PrintStream parameter from Interpreter constructor ahelwer | creating:operators [2025/06/19 14:50] (current) – ALL_MAP_TO interpretation splits out Object value = ahelwer | ||
|---|---|---|---|
| Line 297: | Line 297: | ||
| <code java [highlight_lines_extra=" | <code java [highlight_lines_extra=" | ||
| defineAst(outputDir, | defineAst(outputDir, | ||
| - | " | + | " |
| " | " | ||
| )); | )); | ||
| Line 304: | Line 304: | ||
| We can now parse operators with parameters! | We can now parse operators with parameters! | ||
| On to functions. | On to functions. | ||
| - | This requires defining a new expression type in the '' | + | This requires defining a new expression type in the '' |
| <code java [highlight_lines_extra=" | <code java [highlight_lines_extra=" | ||
| defineAst(outputDir, | defineAst(outputDir, | ||
| Line 569: | Line 569: | ||
| One important thing to note is that unlike in '' | One important thing to note is that unlike in '' | ||
| <code haskell> | <code haskell> | ||
| - | op(x) == \A y \in 0 .. 2 : y < x | + | op(x) == \A y \in 0 .. 2 : y < x |
| </ | </ | ||
| Here's how we implement the '' | Here's how we implement the '' | ||
| Line 584: | Line 584: | ||
| </ | </ | ||
| Finally, here's how we implement the '' | Finally, here's how we implement the '' | ||
| - | <code java [highlight_lines_extra=" | + | <code java [highlight_lines_extra=" |
| case ALL_MAP_TO: { | case ALL_MAP_TO: { | ||
| Token param = expr.params.get(0); | Token param = expr.params.get(0); | ||
| Map< | Map< | ||
| for (Environment binding : bindings) { | for (Environment binding : bindings) { | ||
| - | function.put(binding.get(param), | + | |
| + | | ||
| } | } | ||
| return function; | return function; | ||