inauguration 0.2.0

.in language and general compiler CLI (Core IR, hybrid SIL, staging, plugins)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
use serde::Serialize;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
pub struct LanguageSupport {
    pub language: &'static str,
    pub parser_id: Option<&'static str>,
    pub extensions: &'static [&'static str],
    pub level: u8,
    pub level_label: &'static str,
    pub front: &'static str,
    pub runtime_boundary: &'static str,
    pub example: &'static str,
    pub next_step: &'static str,
}

pub const LANGUAGE_SUPPORT: &[LanguageSupport] = &[
    LanguageSupport {
        language: "in",
        parser_id: Some("in"),
        extensions: &["in"],
        level: 5,
        level_label: "bounded Core IR body subset with source diagnostics, family typecheck; closures, try/catch, throw",
        front: "in_lang_parse",
        runtime_boundary: "self-hosted Core IR to textual SIL and bytecode VM subset",
        example: "apps/polyglot-sample/sample.in",
        next_step: "Deepen closure runtime semantics, package binding execution boundaries, and richer class/interface lowering",
    },
    LanguageSupport {
        language: "icore",
        parser_id: Some("icore"),
        extensions: &["icore"],
        level: 5,
        level_label: "versioned Core IR JSON with bounded bodies",
        front: "compiler::icore",
        runtime_boundary: "self-hosted Core IR to textual SIL and bytecode VM subset",
        example: "apps/polyglot-sample/sample.icore",
        next_step: "Keep schema stable and add conformance fixtures from external emitters",
    },
    LanguageSupport {
        language: "Swift",
        parser_id: Some("swift"),
        extensions: &["swift"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with class/protocol extraction and family typecheck",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR, textual SIL, Boundary IR; Swift runtime is not bundled",
        example: "apps/polyglot-sample/sample.swift",
        next_step: "Deepen method extraction, enum lowering, and Swift runtime strategy",
    },
    LanguageSupport {
        language: "Rust",
        parser_id: Some("rust"),
        extensions: &["rs"],
        level: 4,
        level_label: "dedicated bounded class (impl) and body lowering",
        front: "compiler::rust_front",
        runtime_boundary: "Core IR and textual SIL; rustc is validation only",
        example: "apps/polyglot-sample/sample_class.rs",
        next_step: "Deepen trait support, generics, and remove validation from default success paths",
    },
    LanguageSupport {
        language: "Go",
        parser_id: Some("go"),
        extensions: &["go"],
        level: 4,
        level_label: "dedicated bounded body lowering with struct+method class grouping",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL",
        example: "apps/polyglot-sample/sample_class.go",
        next_step: "Deepen declarations, packages, and control flow; add full method body support in class lowering",
    },
    LanguageSupport {
        language: "V",
        parser_id: Some("v"),
        extensions: &["v"],
        level: 5,
        level_label: "dedicated bounded body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL",
        example: "apps/polyglot-sample/sample.v",
        next_step: "Deepen module syntax, structs, and control flow",
    },
    LanguageSupport {
        language: "C",
        parser_id: Some("c"),
        extensions: &["c", "h"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; libc/runtime ABI is not bundled",
        example: "apps/polyglot-sample/sample.c",
        next_step: "Add pointer types, declarator metadata, and ABI boundaries",
    },
    LanguageSupport {
        language: "C++",
        parser_id: Some("cpp"),
        extensions: &["cc", "cpp", "cxx", "hpp", "hxx", "hh", "h++", "ipp"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering (class/struct lowering pending)",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; standard library/runtime ABI is not bundled",
        example: "apps/polyglot-sample/sample_class.cpp",
        next_step: "Add class_specifier lowering to Decl::Class, methods, templates-as-metadata, and ABI boundaries",
    },
    LanguageSupport {
        language: "Objective-C",
        parser_id: Some("objc"),
        extensions: &["m"],
        level: 4,
        level_label: "Tree-sitter declaration extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR declarations only; Objective-C runtime is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add Objective-C method metadata, bounded bodies, and runtime boundary docs",
    },
    LanguageSupport {
        language: "Objective-C++",
        parser_id: Some("objc++"),
        extensions: &["mm"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; Objective-C++ runtime/ABI is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add method metadata, C++ interop boundaries, and ABI docs",
    },
    LanguageSupport {
        language: "Java",
        parser_id: Some("java"),
        extensions: &["java"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with class/interface extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; JVM runtime is not bundled",
        example: "apps/polyglot-sample/Sample.java",
        next_step: "Add constructors, full field type resolution, and JVM runtime strategy",
    },
    LanguageSupport {
        language: "Groovy",
        parser_id: Some("groovy"),
        extensions: &["groovy"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; JVM runtime is not bundled",
        example: "apps/polyglot-sample/Sample.groovy",
        next_step: "Share JVM-family lowering with Java and Kotlin",
    },
    LanguageSupport {
        language: "JavaScript",
        parser_id: Some("javascript"),
        extensions: &["js", "mjs", "cjs", "jsx"],
        level: 5,
        level_label: "Tree-sitter bounded entrypoint with Boundary IR and bytecode VM",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR, Boundary IR, textual SIL, and owned bytecode VM subset; JS runtime is not bundled",
        example: "apps/polyglot-sample/sample.js",
        next_step: "Expand class/closure/arrow semantics beyond the bounded entrypoint subset and define JS runtime strategy",
    },
    LanguageSupport {
        language: "TypeScript",
        parser_id: Some("typescript"),
        extensions: &["ts", "tsx", "mts", "cts"],
        level: 5,
        level_label: "Tree-sitter bounded entrypoint with Boundary IR and bytecode VM",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR, Boundary IR, textual SIL, and owned bytecode VM subset; TS checker/runtime is not bundled",
        example: "apps/polyglot-sample/sample.ts",
        next_step: "Expand typed class/arrow semantics beyond the bounded entrypoint subset and define TS checker/runtime strategy",
    },
    LanguageSupport {
        language: "Kotlin",
        parser_id: Some("kotlin"),
        extensions: &["kt", "kts"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; JVM runtime is not bundled",
        example: "apps/polyglot-sample/Sample.kt",
        next_step: "Share JVM-family class metadata, constructors, and runtime strategy",
    },
    LanguageSupport {
        language: "Scala",
        parser_id: Some("scala"),
        extensions: &["scala", "sc"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with class/trait extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; JVM runtime is not bundled",
        example: "apps/polyglot-sample/sample.scala",
        next_step: "Add parameters, return types, bounded bodies, and JVM runtime strategy",
    },
    LanguageSupport {
        language: "C#",
        parser_id: Some("csharp"),
        extensions: &["cs"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; CLR runtime is not bundled",
        example: "apps/polyglot-sample/Program.cs",
        next_step: "Add properties, generics metadata, and CLR runtime strategy",
    },
    LanguageSupport {
        language: "F#",
        parser_id: Some("fsharp"),
        extensions: &["fs", "fsx", "fsi"],
        level: 4,
        level_label: "Tree-sitter declaration extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR declarations only; CLR runtime is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add parameters, return types, bounded bodies, and CLR runtime strategy",
    },
    LanguageSupport {
        language: "VB.NET",
        parser_id: Some("vb"),
        extensions: &["vb"],
        level: 4,
        level_label: "bounded Function/Sub lowering with family typecheck and optional inline boundary metadata",
        front: "compiler::vb_boundary",
        runtime_boundary: "Core IR and textual SIL; CLR runtime is not bundled",
        example: "apps/polyglot-sample/sample.vb",
        next_step: "Deepen modules, properties, and boundary probe verification",
    },
    LanguageSupport {
        language: "Python",
        parser_id: Some("python"),
        extensions: &["py", "pyi", "pyw"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; Python runtime is not bundled",
        example: "apps/polyglot-sample/sample.py",
        next_step: "Extract classes, lambdas, and richer bodies from Tree-sitter CST to Core IR",
    },
    LanguageSupport {
        language: "Ruby",
        parser_id: Some("ruby"),
        extensions: &["rb", "rake", "gemspec"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; Ruby runtime is not bundled",
        example: "apps/polyglot-sample/sample.rb",
        next_step: "Add blocks, classes, richer calls, and runtime strategy",
    },
    LanguageSupport {
        language: "PHP",
        parser_id: Some("php"),
        extensions: &["php", "phtml"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with family typecheck",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; PHP runtime is not bundled",
        example: "apps/polyglot-sample/sample.php",
        next_step: "Add traits, namespaces, and richer class metadata",
    },
    LanguageSupport {
        language: "Perl",
        parser_id: Some("perl"),
        extensions: &["pl", "pm"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with package/class extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; Perl runtime is not bundled",
        example: "apps/polyglot-sample/sample.pl",
        next_step: "Add parameters, bounded bodies, and runtime strategy",
    },
    LanguageSupport {
        language: "Zig",
        parser_id: Some("zig"),
        extensions: &["zig"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with family typecheck",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; Zig runtime/ABI is not bundled",
        example: "apps/polyglot-sample/sample.zig",
        next_step: "Add comptime-aware boundaries and ABI metadata",
    },
    LanguageSupport {
        language: "Dart",
        parser_id: Some("dart"),
        extensions: &["dart"],
        level: 4,
        level_label: "Tree-sitter bounded scalar body lowering",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; Dart runtime is not bundled",
        example: "apps/polyglot-sample/sample.dart",
        next_step: "Add class metadata, async forms, and runtime policy",
    },
    LanguageSupport {
        language: "Lua",
        parser_id: Some("lua"),
        extensions: &["lua"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with family typecheck",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; Lua runtime is not bundled",
        example: "apps/polyglot-sample/sample.lua",
        next_step: "Add metatables, richer calls, and runtime strategy",
    },
    LanguageSupport {
        language: "Clojure",
        parser_id: Some("clojure"),
        extensions: &["clj", "cljs", "cljc"],
        level: 4,
        level_label: "bounded defn lowering with family typecheck and optional inline boundary metadata",
        front: "compiler::clojure_boundary",
        runtime_boundary: "Core IR and textual SIL; JVM runtime is not bundled",
        example: "apps/polyglot-sample/sample.clj",
        next_step: "Deepen namespaces, macros, and boundary probe verification",
    },
    LanguageSupport {
        language: "Elixir",
        parser_id: Some("elixir"),
        extensions: &["ex", "exs"],
        level: 4,
        level_label: "Tree-sitter declaration extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR declarations only; BEAM runtime is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add arity metadata, bounded bodies, and BEAM runtime strategy",
    },
    LanguageSupport {
        language: "Erlang",
        parser_id: Some("erlang"),
        extensions: &["erl", "hrl"],
        level: 4,
        level_label: "Tree-sitter declaration extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR declarations only; BEAM runtime is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add arity metadata, bounded bodies, and BEAM runtime strategy",
    },
    LanguageSupport {
        language: "Haskell",
        parser_id: Some("haskell"),
        extensions: &["hs", "lhs"],
        level: 4,
        level_label: "Tree-sitter declaration extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR declarations only; Haskell runtime is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add parameters, bounded bodies, and runtime strategy",
    },
    LanguageSupport {
        language: "Nim",
        parser_id: Some("nim"),
        extensions: &["nim"],
        level: 4,
        level_label: "bounded proc lowering with family typecheck and optional inline boundary metadata",
        front: "compiler::nim_boundary",
        runtime_boundary: "Core IR and textual SIL; Nim runtime is not bundled",
        example: "apps/polyglot-sample/sample.nim",
        next_step: "Deepen modules, types, and boundary probe verification",
    },
    LanguageSupport {
        language: "OCaml",
        parser_id: Some("ocaml"),
        extensions: &["ml", "mli"],
        level: 4,
        level_label: "Tree-sitter bounded body lowering with let/function extraction and family typecheck",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR and textual SIL; OCaml runtime is not bundled",
        example: "apps/polyglot-sample/sample.ml",
        next_step: "Deepen let syntax, pattern matching, modules, and OCaml runtime strategy",
    },
    LanguageSupport {
        language: "Julia",
        parser_id: Some("julia"),
        extensions: &["jl"],
        level: 4,
        level_label: "Tree-sitter declaration extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR declarations only; Julia runtime is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add parameters, bounded bodies, and runtime strategy",
    },
    LanguageSupport {
        language: "R",
        parser_id: Some("r"),
        extensions: &["r"],
        level: 4,
        level_label: "Tree-sitter declaration extraction",
        front: "compiler::tree_front",
        runtime_boundary: "Core IR declarations only; R runtime is not bundled",
        example: "docs/architecture/parser-surface.md",
        next_step: "Add parameters, bounded bodies, and runtime strategy",
    },
    LanguageSupport {
        language: "D",
        parser_id: Some("d"),
        extensions: &["d"],
        level: 4,
        level_label: "bounded function lowering with family typecheck and optional inline boundary metadata",
        front: "compiler::d_boundary",
        runtime_boundary: "Core IR and textual SIL; D runtime is not bundled",
        example: "apps/polyglot-sample/sample.d",
        next_step: "Deepen modules, templates, and boundary probe verification",
    },
    LanguageSupport {
        language: "Crystal",
        parser_id: Some("crystal"),
        extensions: &["cr"],
        level: 4,
        level_label: "bounded def lowering with family typecheck and optional inline boundary metadata",
        front: "compiler::crystal_boundary",
        runtime_boundary: "Core IR and textual SIL; Crystal runtime is not bundled",
        example: "apps/polyglot-sample/sample.cr",
        next_step: "Deepen macros, types, and boundary probe verification",
    },
    LanguageSupport {
        language: "Odin",
        parser_id: Some("odin"),
        extensions: &["odin"],
        level: 5,
        level_label: "bounded proc lowering with family typecheck and optional inline boundary metadata",
        front: "compiler::odin_boundary",
        runtime_boundary: "Core IR and textual SIL; Odin runtime is not bundled",
        example: "apps/polyglot-sample/sample.odin",
        next_step: "Deepen packages, foreign blocks, and boundary probe verification",
    },
    LanguageSupport {
        language: "Hare",
        parser_id: Some("hare"),
        extensions: &["ha"],
        level: 4,
        level_label: "bounded fn lowering with family typecheck and optional inline boundary metadata",
        front: "compiler::hare_boundary",
        runtime_boundary: "Core IR and textual SIL; Hare runtime is not bundled",
        example: "apps/polyglot-sample/sample.ha",
        next_step: "Deepen types, exports, and boundary probe verification",
    },
];

#[must_use]
pub fn all_language_support() -> &'static [LanguageSupport] {
    LANGUAGE_SUPPORT
}

#[must_use]
pub fn language_support_for_parser(parser_id: &str) -> Option<&'static LanguageSupport> {
    LANGUAGE_SUPPORT
        .iter()
        .find(|entry| entry.parser_id == Some(parser_id))
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::parser_registry::ParserId;

    #[test]
    fn matrix_tracks_every_parser_id() {
        for parser_id in [
            ParserId::In,
            ParserId::Icore,
            ParserId::C,
            ParserId::Cpp,
            ParserId::ObjC,
            ParserId::ObjCpp,
            ParserId::Java,
            ParserId::Kotlin,
            ParserId::Scala,
            ParserId::CSharp,
            ParserId::FSharp,
            ParserId::VbNet,
            ParserId::Python,
            ParserId::Ruby,
            ParserId::Php,
            ParserId::Perl,
            ParserId::JavaScript,
            ParserId::TypeScript,
            ParserId::Go,
            ParserId::V,
            ParserId::Rust,
            ParserId::Zig,
            ParserId::Dart,
            ParserId::Lua,
            ParserId::Clojure,
            ParserId::Groovy,
            ParserId::Elixir,
            ParserId::Erlang,
            ParserId::Haskell,
            ParserId::OCaml,
            ParserId::Julia,
            ParserId::R,
            ParserId::Nim,
            ParserId::D,
            ParserId::Crystal,
            ParserId::Odin,
            ParserId::Hare,
        ] {
            assert!(
                LANGUAGE_SUPPORT
                    .iter()
                    .any(|entry| entry.parser_id == Some(parser_id.as_str())),
                "missing parser id {}",
                parser_id.as_str()
            );
        }
    }

    #[test]
    fn ruby_reports_bounded_body_lowering() {
        let entry = language_support_for_parser(ParserId::Ruby.as_str()).expect("ruby");
        assert_eq!(entry.level, 4);
        assert!(entry.level_label.contains("body"));
        assert!(entry.runtime_boundary.contains("Core IR"));
    }

    #[test]
    fn level_five_fronts_include_dedicated_fronts() {
        for language in ["in", "icore", "V", "JavaScript", "TypeScript", "Odin"] {
            let entry = LANGUAGE_SUPPORT
                .iter()
                .find(|entry| entry.language == language)
                .expect(language);
            assert_eq!(entry.level, 5, "{}", language);
        }
    }

    #[test]
    fn all_languages_are_level_four_or_five() {
        for entry in LANGUAGE_SUPPORT.iter() {
            assert!(entry.level >= 4, "{} should be level >= 4", entry.language);
        }
    }

    #[test]
    fn javascript_and_typescript_report_bounded_bytecode_vm_level() {
        for language in ["JavaScript", "TypeScript"] {
            let entry = LANGUAGE_SUPPORT
                .iter()
                .find(|entry| entry.language == language)
                .expect(language);
            assert_eq!(entry.level, 5, "{language}");
            assert!(entry.level_label.contains("bytecode VM"), "{language}");
            assert!(entry.runtime_boundary.contains("Boundary IR"), "{language}");
        }
    }

    #[test]
    fn routed_languages_have_examples() {
        for entry in LANGUAGE_SUPPORT.iter().filter(|entry| {
            entry.parser_id.is_some() && entry.language != "in" && entry.language != "icore"
        }) {
            assert!(
                !entry.example.is_empty(),
                "{} should report an example or documentation surface, got {}",
                entry.language,
                entry.example
            );
        }
    }
}