1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 08:55:38 +00:00

README: list new language features and examples

Updates the feature list to mention structs, enums, for loops,
match, inline asm + \`{var}\` substitution, \`poke\`/\`peek\`
intrinsics, and the new \`--memory-map\` / \`--call-graph\`
diagnostics. Adds the two new examples (structs_enums_for and
inline_asm_demo) to the table.

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
Claude 2026-04-12 18:07:47 +00:00
parent 629e596ec7
commit c7b94b2df7
No known key found for this signature in database

View file

@ -42,14 +42,18 @@ start Main
## Features
- **Game-aware syntax** -- states, sprites, palettes, and input are first-class constructs
- **Full type system** -- `u8`, `i8`, `u16`, `bool`, fixed-size arrays (`u8[N]`)
- **Full type system** -- `u8`, `i8`, `u16`, `bool`, fixed-size arrays (`u8[N]`), `enum`, `struct`
- **Rich control flow** -- `if`/`else`, `while`, `for i in 0..N`, `loop`, `match`
- **Functions** -- with parameters, return types, `inline` hint, recursion detection
- **State machines** -- `state` with `on enter`, `on exit`, `on frame` handlers
- **Compile-time safety** -- call depth limits, recursion detection, type checking
- **Optimizer** -- constant folding, dead code elimination, strength reduction
- **Multiple mappers** -- NROM, MMC1, UxROM, MMC3
- **State machines** -- `state` with `on enter`, `on exit`, `on frame`, `on scanline(N)` handlers
- **Compile-time safety** -- call depth limits, recursion detection, type checking, unused-var warnings
- **IR-based optimizer** -- constant folding, dead code elimination, strength reduction, copy propagation, peephole passes
- **Multiple mappers** -- NROM, MMC1, UxROM, MMC3 (including scanline IRQ dispatch)
- **Asset pipeline** -- PNG-to-CHR conversion, palette definitions, inline tile data
- **Debug support** -- `--debug` flag, source maps, Mesen-compatible symbol export
- **Inline assembly** -- `asm { ... }` with `{var}` substitution, plus `raw asm { ... }` for verbatim blocks
- **Hardware intrinsics** -- `poke(addr, value)` / `peek(addr)` for direct register access
- **Debug support** -- `--debug` flag, source maps, Mesen-compatible symbol export, `debug.log` / `debug.assert`
- **Compile-time diagnostics** -- `--dump-ir`, `--memory-map`, `--call-graph` flags
- **Single binary** -- no dependencies on ca65, Python, or any external tools
## Documentation
@ -70,6 +74,8 @@ start Main
| [`state_machine.ne`](examples/state_machine.ne) | State transitions, on enter/exit, timers |
| [`sprites_and_palettes.ne`](examples/sprites_and_palettes.ne) | Inline CHR data, palettes, scroll, type casting |
| [`mmc1_banked.ne`](examples/mmc1_banked.ne) | MMC1 mapper, bank declarations, multiply |
| [`structs_enums_for.ne`](examples/structs_enums_for.ne) | Structs, enums, `for` loops, struct literals |
| [`inline_asm_demo.ne`](examples/inline_asm_demo.ne) | Inline asm with `{var}` substitution, `poke`/`peek` |
## Compiler Commands