Skip to content

Commit a2f42c0

Browse files
akoclaude
andcommitted
chore: remove generated ANTLR parser from git; add CI grammar step (#514)
The generated mdl/grammar/parser/ files (~120k lines of mdl_parser.go) are deterministically derived from the .g4 source. Tracking them causes unresolvable merge conflicts whenever two branches run make grammar. Changes: - .gitignore: ignore mdl/grammar/parser/ directory - git rm --cached: untrack 8 generated files (4 .go, 2 .interp, 2 .tokens) - CI workflows: add ANTLR4 install + make grammar before make build/release in push-test.yml, release.yml, and nightly.yml (both jobs) - JAR cached at ~/.m2/repository/org/antlr/antlr4 with key antlr4-4.13.2 to avoid re-downloading on every run The devcontainer Dockerfile already installs antlr4-tools; no change needed there. Run 'make grammar' after editing any .g4 file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f96a037 commit a2f42c0

12 files changed

Lines changed: 39 additions & 133781 deletions

.github/workflows/nightly.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ jobs:
2424
with:
2525
go-version: '1.26'
2626

27+
- name: Cache ANTLR4 JAR
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.m2/repository/org/antlr/antlr4
31+
key: antlr4-4.13.2
32+
- name: Install ANTLR4
33+
run: pip install 'antlr4-tools==0.2.2'
34+
- name: Generate parser
35+
run: make grammar
2736
- name: Build
2837
run: make build
2938

@@ -51,6 +60,16 @@ jobs:
5160

5261
- uses: oven-sh/setup-bun@v2
5362

63+
- name: Cache ANTLR4 JAR
64+
uses: actions/cache@v4
65+
with:
66+
path: ~/.m2/repository/org/antlr/antlr4
67+
key: antlr4-4.13.2
68+
- name: Install ANTLR4
69+
run: pip install 'antlr4-tools==0.2.2'
70+
- name: Generate parser
71+
run: make grammar
72+
5473
- name: Check for new commits since last nightly
5574
id: check
5675
run: |

.github/workflows/push-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ jobs:
1313
- uses: actions/setup-go@v6
1414
with:
1515
go-version: '1.26'
16+
- name: Cache ANTLR4 JAR
17+
uses: actions/cache@v4
18+
with:
19+
path: ~/.m2/repository/org/antlr/antlr4
20+
key: antlr4-4.13.2
21+
- name: Install ANTLR4
22+
run: pip install 'antlr4-tools==0.2.2'
23+
- name: Generate parser
24+
run: make grammar
1625
- name: Build
1726
run: make build
1827
- name: Test

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ jobs:
1919
with:
2020
go-version: '1.26'
2121
- uses: oven-sh/setup-bun@v2
22+
- name: Cache ANTLR4 JAR
23+
uses: actions/cache@v4
24+
with:
25+
path: ~/.m2/repository/org/antlr/antlr4
26+
key: antlr4-4.13.2
27+
- name: Install ANTLR4
28+
run: pip install 'antlr4-tools==0.2.2'
29+
- name: Generate parser
30+
run: make grammar
2231
- name: Build release binaries
2332
run: make release
2433
- name: Create GitHub Release

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ mx-test-projects/*/
3939
tmp/
4040

4141
# Generated files
42+
# ANTLR4 parser (regenerate with: make grammar)
43+
mdl/grammar/parser/
4244
*.pdf
4345
*.tar
4446
*.tgz

0 commit comments

Comments
 (0)