Add language specification document

This commit introduces the BNF for the Myc language, along with its core
semantics, data types, and evaluation logic. It also details the macro
system and provides an overview of the standard library. This document
serves as a foundational context for LLMs to understand and generate Myc
code.
This commit is contained in:
Michael Schimmel
2026-03-06 11:35:18 +01:00
parent 9ba4f795d1
commit 32a1f21463
7 changed files with 221 additions and 50 deletions
+15
View File
@@ -7,6 +7,7 @@ pub fn register(env: &Environment) {
register_arithmetic(env);
register_comparison(env);
register_logic(env);
register_io(env);
}
fn register_constants(env: &Environment) {
@@ -489,3 +490,17 @@ fn register_logic(env: &Environment) {
}
});
}
fn register_io(env: &Environment) {
let print_ty = StaticType::Function(Box::new(Signature {
params: StaticType::Any,
ret: StaticType::Void,
}));
env.register_native_fn("print", print_ty, Purity::Impure, |args| {
for arg in args {
print!("{}", arg);
}
println!();
Value::Void
});
}