Contributing - amir1387aht/MicroCS GitHub Wiki
Thanks for helping! MicroCS runs on devices where a crash means a bricked field unit, so the bar is "tested and honest" rather than "big".
-
make checkstays green โ tests, GC-stress run and all feature-flag builds with-Werror. -
Behaviour is defined by
.outfiles. A new language feature needs a test; if it is plain C#, its output must be byte-identical to .NET (tools/verify_dotnet.sh). -
Docs describe the code, not the plan. Label anything unfinished as ๐งช experimental or
๐๏ธ planned. Every number must come from a command in
docs/PERFORMANCE.md. - C99, no dependencies, no global state in the core (state lives in the VM; modules use extension slots).
-
Public API is append-only (
include/mcs.h); opcodes are append-only and a format change bumpsIMG_VERSION.
make check # must pass
make asan-test # sanitizers (then `make clean && make`)
python3 tools/fuzz.py ./mcs 1000 $RANDOM # for parser/compiler/VM changes
tools/verify_dotnet.sh # for language/library changes (needs dotnet 8)
make cm-check # for anything that could affect 32-bit targets
python3 tools/gen_stdlib_doc.py > docs/STDLIB.md # after adding library members| Change | Code | Docs / tests |
|---|---|---|
| New syntax |
src/mcs_lexer.c, src/mcs_parser.c (desugar if possible), src/mcs_compiler.c
|
docs/LANGUAGE.md, tests/t*.cs
|
| New library member |
src/mcs_lib*.c registration tables |
regenerate docs/STDLIB.md, add to a test |
| New opcode | append to MCS_OPCODES in src/mcs_internal.h, VM case, disassembler, loader validation |
docs/BYTECODE.md |
| New module / peripheral |
modules/<name>/, public headers only, MCS_ENABLE_<NAME> flag |
docs/<NAME>.md, FLAG_SETS in the Makefile |
| New port | ports/<target>/ |
docs/PORTING.md |
4-space indent, K&R braces, snake_case, mcs_ prefix for anything public, comments that
explain why. Keep hot paths in src/mcs_vm.c allocation-free and remember that the GC only
runs at safepoints โ new roots must be reachable from mark_roots.