exam.mnst
The smallest "hello world" style program for quick sanity checks.
mst run exam.mnst
These examples ship with the repository and mirror the current compiler feature set.
exam.mnstThe smallest "hello world" style program for quick sanity checks.
mst run exam.mnst
examples/argv.mnstShows main(argc, argv) and forwarded CLI arguments.
mst run examples/argv.mnst -- hello
examples/constants.mnstUses top-level const declarations for scalar and string values.
mst run examples/constants.mnst
examples/file_io.mnstReads a file into memory, defers cleanup with std/mem.mnst, prints its size, and writes a copy back out.
mst run examples/file_io.mnst -- exam.mnst
examples/defer_scope.mnstShows scoped defer cleanup on normal block exit, continue, break, and return.
mst run examples/defer_scope.mnst
examples/imports/main.mnstDemonstrates file imports, module aliases, and loop control.
mst run examples/imports/main.mnst
examples/enum.mnstIntroduces C-like enums and enum comparisons.
mst run examples/enum.mnst
examples/payload_enum.mnstShows payload-carrying enums before match enters the picture.
mst run examples/payload_enum.mnst
examples/match.mnstExercises enum-only match expressions with payload binding.
mst run examples/match.mnst
examples/string_bytes.mnstUses std/str.mnst and std/mem.mnst helpers to copy and compare a C-style string buffer.
mst run examples/string_bytes.mnst
examples/growable_vec_i32.mnstShows a growable vector built on the early std/vec_i32.mnst module with malloc, realloc, free, and defer.
mst run examples/growable_vec_i32.mnst
selfhost/main.mnstRuns the first Monster-written self-hosting slice: a lexer prototype that scans Monster source into a token buffer.
mst run selfhost/main.mnst -- exam.mnst
The repository also includes a raw IR snapshot at
examples/growable_vec_i32.ll, emitted by the current compiler.