When building a language with Langium, the mandatory language package contains the core grammar, AST, and service definitions. The following files constitute the standard structure of this package:
Core Implementation Files
src/<language-id>.langium: The grammar definition of your language.src/<language-id>-module.ts: The dependency injection module. Use this to register overridden or additional services.src/<language-id>-validator.ts: An example validator file where you implement your language's semantic rules.src/index.ts: The entry point that defines which parts of the package are exported to other packages.
Generated Files (via langium generate)
These files are automatically produced by the Langium generator:
src/generated/ast.ts: The Abstract Syntax Tree (AST) definitions.src/generated/grammar.ts: The generated grammar implementation.src/generated/module.ts: The generated dependency injection module.
Syntax Highlighting
src/syntaxes/<language-id>.monarch.ts: Monarch-based syntax highlighting instructions.syntaxes/<language-id>.tmLanguage.json: Textmate-based syntax highlighting instructions.
Configuration
package.json: The manifest file for the language package.tsconfig.json: The package-specific TypeScript configuration, extending the base project config.
If testing was enabled during generation, the package also includes:
tsconfig.test.json: TypeScript configuration for unit tests.test/linking.test.ts: Tests for the linking phase.test/parsing.test.ts: Tests for the parsing phase.test/validating.test.ts: Tests for the validation phase.