Commit Graph

9 Commits

Author SHA1 Message Date
hgranthorner
37809b8aa7 Phase 3: Grammar-Kit parser, PSI and ParserDefinition
Adds src/main/grammar/Jai.bnf, the generated parser/PSI in src/main/gen, a
JaiParserDefinition, and the Tier 3 corpus parse gate (406/714 files clean).

Two things were not obvious:

- Grammar-Kit mints its own token instances from the .bnf 'tokens' block, which
  are different objects from the ones JaiLexer emits, so every rule silently
  failed to match. Fixed with tokenTypeFactory -> JaiTokenTypes.byName.
- A backslash inside an identifier is a continuation in the compiler's lexer
  (Jai_Lexer/module.jai:444): 'left\_margin' is one identifier. JaiLexer now
  does the same; the Tier 0 round-trip still holds because the token span
  covers the backslash and the skipped spaces.

Constructs that BNF alone cannot express live in JaiParserUtil: directive-name
tests (#ident is one token), '==' before '{' for the switch form, procedure
header vs parenthesised expression, and the declaration lookahead.
2026-08-04 12:05:42 -04:00
hgranthorner
746647d27d Build an installable plugin ZIP: real README/CHANGELOG, cache-poisoning recovery
- README documents install-from-disk and what actually works today
- jaitest prints the recovery steps when a poisoned build cache makes
  :test report NO-SOURCE, and AGENTS.md records the failure mode
2026-08-04 10:42:10 -04:00
hgranthorner
f52b8c5899 Update AGENTS.md for phases 0-2: verified state, lexer design facts, gotchas 2026-08-04 10:35:48 -04:00
hgranthorner
fa15109f0b Phase 2: commenter and brace matcher
Brace matching pairs the Jai-specific single-token openers .{ and .[ with the
ordinary } and ]; verified headlessly through the editor highlighter.
2026-08-04 10:29:43 -04:00
hgranthorner
2c5d7f713b Phase 2: syntax highlighting and colour settings page
- JaiSyntaxHighlighter maps every one of the lexer's token types; asserted over
  the whole corpus (105 distinct token types seen, all mapped)
- JaiHighlightingLexer refines IDENT into built-in types and loop variables for
  colouring only, so the parser never sees them as reserved
- colour settings page with a demo file that is itself asserted to lex cleanly
2026-08-04 10:28:15 -04:00
hgranthorner
ba5d8aba7b Phase 1 gate: Tier 0 corpus lexer invariants over the whole Jai distribution
Lexes all 714 .jai files (17.1M chars, 3.0M tokens) and asserts round-trip
tiling, strict offset progress, and zero BAD_CHARACTER. Green on first run.

jaitest: use cleanTest and retry once when a concurrent Gradle run clobbers
build/test-results (java.io.EOFException with no XML).
2026-08-04 10:25:01 -04:00
hgranthorner
4469283024 Phase 1: hand-written Jai lexer + Tier 1 golden token tests
JaiLexer mirrors compose_new_token in the compiler's own lexer. Nested block
comments and here-strings are each consumed inside a single token, so the lexer
state is always 0 and it can restart at any token boundary.

13 plain-JUnit tests, one per gotcha in the language reference §14.
2026-08-04 10:22:58 -04:00
hgranthorner
711334885b Phase 0: strip JetBrains template, register Jai language and file type
- delete demo tool window + message bundle, rewrite plugin.xml metadata
- add JaiLanguage, JaiFileType, file icon, JaiTokenTypes (from the compiler's
  own lexer: modules/Jai_Lexer/module.jai)
- add ./jaitest: runs tests and reports the JUnit XML, not just the exit code
- ignore .kotlin
2026-08-04 10:19:11 -04:00
hgranthorner
cb5a1d9555 initial commit 2026-08-04 10:12:15 -04:00