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:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user