Modal is a matrioshka language based on pattern-matching to rewrite trees

# · ✸ 92 · 💬 21 · 10 days ago · wiki.xxiivv.com · smlavine · 📷
Modal programs are represented as a series of substitution rules, applied to a given tree which gets continually modified until no rules match any given part of the tree. Modal is homoiconic, as any string is a potential program and new rules can be composed directly during the evaluation. Trees can be found in rules and program data, they include words, registers and nested trees. Rules can match specific trees and rewrite their content in a new sequence. An efficient way to represent an array is to store information in nested lists, it allows for rules to target specific segments of the list, similarly to Lisp's car and cdr primitives. Understanding how to use types to guard rules for specific evaluation order is important to become proficient with Modal. Creating a type system is merely a matter of creating stricter rules expecting a specific grammar.
Modal is a matrioshka language based on pattern-matching to rewrite trees



Send Feedback | WebAssembly Version (beta)