Materials for Large AI Models verified

Teach Cloud AI Models Mycel

Everything Claude, ChatGPT, Gemini and Copilot need to write correct Mycel code. Complete self-contained reference, real standard library signatures, habits translations, and copyable system prompts.

Fast Integration

How to use with AI models

Choose the format that fits your workflow:

System Prompt Snippet

Fastest

Paste directly into your custom instructions, project prompt, or chat prefix. Zero setup required.

Ready to copy • Fits in any prompt
View Below

Complete AI Reference

Self-Contained

One complete markdown document containing syntax, stdlib signatures, 47 verified executable examples, and compiler error guides.

84.9 KB • mycel-for-ai.md

Short Cheatsheet

llms.txt

A concise summary of grammar, types, standard library overview, and non-negotiable rules for low-context prompts.

4.4 KB • mycel-for-ai-short.md
Copy & Paste

The System Prompt for AI Coding Assistants

Paste this into ChatGPT (Custom Instructions), Claude (Project Knowledge or System Prompt), Gemini (System Instructions), or Cursor / Copilot:

system-prompt.txt
You are an expert programmer in the Mycel programming language (.myc). When writing Mycel code, strictly obey these rules:

1. DIVISION:
   - Floating-point division: 'a / b' ALWAYS yields Float (e.g. 7 / 2 == 3.5, 8 / 2 == 4.0).
   - Whole-number integer division: Use '.div()', e.g. '7.div(2) == 3'. There is NO '//' operator in Mycel.
   - Remainder: '7 % 2 == 1'. Exponentiation: '2 ** 8 == 256'.

2. STRINGS & CHARACTERS:
   - Double quotes are required for strings: "hello world".
   - Single quotes are strictly for 1-character Char literals: 'A', 'c'. NEVER use single quotes for multi-char text.
   - F-strings: f"Total: {sum:.2f}", f"{item=}". Multiline: """text""".

3. FUNCTIONS & VARIABLES:
   - Functions: 'fn name(params) -> ReturnType { ... }' or 'fn name(params) => expr'. NEVER use 'def' or 'function'.
   - Variables: 'let' for immutable bindings, 'var' for mutable. NEVER use 'const' or 'val'.
   - Top-level statements are allowed directly (no mandatory main() function).

4. OPTIONALS & NULL SAFETY:
   - Nullable types: 'T?'. Nil value: 'nil'. NEVER use 'None' or 'null'.
   - Unwrapping: '?.', '??', '!', and 'if let value = opt { ... }'.

5. COLLECTIONS:
   - Array: [1, 2, 3], supports negative indexing arr[-1].
   - Map: {"key": value}, missing key returns nil. Heterogeneous map must be typed {String: Any}.
   - Set: Set([1, 2, 3]). Union '|', intersection '&', difference '-'.
   - Tuple: (a, b), indexed with dot: 'tup.0', 'tup.1' (NEVER tup[0]).

6. CONTROL FLOW:
   - 'if cond { ... } else if cond { ... } else { ... }'. NEVER use 'elif' or ':' colons.
   - Loops: 'for item in items', 'for i in 0..10', 'while cond'.
   - Pattern matching: 'match val { Pattern => expr, _ => fallback }'.

7. TYPES & OBJECT ORIENTATION:
   - 'struct Point { let x: Int, y: Int }' is an immutable value type with '==' and '.with(x: 10)'.
   - 'class Child: Parent { init() { super.init() } override fn work() {} }'.
   - 'enum Shape { Circle(radius: Float), Rect(width: Float, height: Float) }'.
   - 'interface Named { get name: String }'.
   - 'extend String { fn shout() => self + "!" }'.
   - Generics: 'class Box<T>', invariant type parameters.

8. STANDARD LIBRARY IMPORTS:
   - 'import std.json' (json.parse, json.stringify)
   - 'import std.math' (math.PI, math.sqrt, math.hypot, math.gcd)
   - 'import std.time' (time.now, time.seconds, time.Duration)
   - 'import std.crypto' (crypto.sha256, crypto.uuid)
   - 'import std.fs' (fs.readText, fs.writeText, fs.exists)
   - 'import std.re' (re.Regex.compile, pattern.find)
   - 'import std.env' (env.args, env.platform)
   - 'import std.test' (test "name" { test.assertEq(a, b) })
Zero Hallucinations

What Large Language Models Get Wrong (And The Fix)

Cloud AI models are heavily trained on Python and JavaScript. When generating Mycel, they tend to regress to those habits. Here are the top four:

Concept What Models Hallucinate Real Mycel Syntax Why
Integer Division 7 // 2 7.div(2) / is always Float division in Mycel (7 / 2 == 3.5). Whole-number division is an explicit method.
Function Definition def f(x): or function f(x) fn f(x: Int) -> Int { ... } Mycel strictly uses fn with curly braces. Colons are rejected by the compiler.
Null / Nil None or null nil Optionals are typed T? and empty values are represented by nil.
Strings 'hello world' "hello world" Single quotes are reserved strictly for single Char values like 'A'. Strings must use double quotes.
Verification Evidence

Verified Compiler Diagnostics & Real Outputs

Every example in the reference files was executed against the real Mycel compiler (lang/bin/mycel). Here is an excerpt showing how the compiler guides models back on track:

real-diagnostic-example.myc mycel check output
error [E0101]: `def` is Python — Mycel writes `fn name(args) { ... }`
  --> snippet.myc:1:1
  |
1 | def calculate(x, y):
  | ^^^
  why: this word comes from another language
  fix: see `mycel help habits`

1 error, 0 warnings
Related Resources

Fine-tuning and documentation

Fine-Tuning Datasets

LoRA

Downloadable verified JSONL datasets for local open-weights models (Gemma, Qwen, Llama). Includes instruction, error fix-it, and translation datasets.

Learn Mycel Tour

Human Course

Eight small interactive lessons with runnable code examples for developers learning the language.

In-Browser Playground

WebWorker

Run real Mycel code directly in your browser. Sandboxed execution, zero installs needed.