experimental optimizing MeTTa compiler.
Compiles MeTTa to a target language which is prolog. The target language output is slightly optimized.
install swi-prolog dependencies by running the prolog and confirming everything with "yes"
swipl ./INSTALL.prolog
source source code is read from PATHTOFILE
basic running
./eomc.sh PATHTOFILE
running with dumping generated code to terminal
./eomc.sh PATHTOFILE && echo "" && cat generated0.prolog
running with dumping generated code to terminal and executing generated program with swi-prolog
./eomc.sh PATHTOFILE && cat generated0.prolog && swipl -s generated0.prolog -g entry0 -g halt
(= (exampleFunctionA) (* (+ 2.2 3) 6) )
- compiler: there is virtually no semantics checking. The code has to be sematically correct so that the compiler produces correct output.
- lexer : the lexeer doesn't parse anything with
*,-etc. correctly. solet2has to be used instead oflet*etc. for now. - runtime: there is only a minimal stdlib implemented.
- only the simplistic bare minimal features of the language are supported for now. That means no
caseand implementation of interpreterm etc.
| feature | parser | backend |
|---|---|---|
| datatype:boolean | yes | yes |
| datatype:int | yes | yes |
| datatype:float | yes | yes |
| function declaration | full | full |
| function invocation | yes | yes |
| variable definition/usage | yes | yes |
| control flow: conditionals | yes | yes |
| control flow: sequential | - | yes |
| data flow: let | yes | yes |
| datastructure declaration | yes | yes |
| datastructure unification | - | (yes) |
| feature | parser | runtime |
|---|---|---|
| basic math (+, *, etc.) | - | yes |
| basic math (cos, etc.) | - | (yes) |
| comparison | - | yes |
| collapse function | - | yes |
| superpose function | - | yes |
| match function | - | no |
| call into python | - | no |
for the compiler swi-prolog is supported. Backend swi-prolog is supported and recommended. Other Prolog environments such as GNU-prolog could also work.
here are version which are relativly stable
https://github.com/PtrMan/eomc/tree/06117da9455c63629806f015f1e8dd94cbe39e54 from 07-28-2025 . no known issues