Adding Languages
Criteria for a new language
- Has a syntax that needs to be compiled/transpiled to work in browsers (e.g. not a JS library).
- A compiler/runtime that runs client-side in the browser (not on a remote server).
- Its output can be represented in a web page.
- Relatively popular (e.g. at least hundreds of GitHub stars/thousands of weekly downloads).
- Not esoteric (otherwise, convince me if you have a good use case).
- The compiler/runtime is still reasonably maintained.
- The compiler/runtime has a permissive license compatible with MIT license.
If you still have doubts if the language qualifies, let's discuss it.
Checklist when adding
flowchart TD
A[Add Language] --> B["Create language specs<br/>src/livecodes/languages/"]
B --> C["Add to languages.ts<br/>or processors.ts"]
C --> D{"Compiler needs<br/>separate build?"}
D -->|Yes| E["Add to build script<br/>scripts/build.js"]
D -->|No| F{"New packages/<br/>static files?"}
F -->|Yes| G["Add to browser-compilers repo<br/>and CDN"]
F -->|No| H["Reference vendors.ts<br/>for CDN links"]
E --> H
G --> H
H --> I["Add name/aliases<br/>to sdk/models.ts"]
I --> J["Add editor support<br/>Monaco/CodeMirror/Prismjs"]
J --> K["Add language info<br/>html/language-info.html"]
K --> L{"Starter template?"}
L -->|Yes| M["Create template<br/>Add to TemplateList, command-menu,<br/>language-info"]
L -->|No| N["Add e2e tests"]
M --> N
N --> O["Add language docs<br/>docs/docs/languages/"]
O --> P["Add to docs slider<br/>LanguageSliders.tsx"]
P --> Q["Add licenses<br/>vendor-licenses.mdx"]
Q --> R["Update badge<br/>README.mdx"]
- Add language specs and include that in the list of languages or processors.
- The compiler +/- formatter should be lazy-loaded.
- If the compiler needs a separate build, add it to the build script.
- If the compiler/formatter require installing new packages or adding static files (e.g. wasm) add them to the browser compilers repo and load them from CDN.
- Any links to CDN hosted assets should be referenced from list of vendors.
- Add language name and aliases to models.
- Add editor support (e.g. syntax highlighting) for Monaco, CodeMirror and Prismjs (if not auto-loaded).
- Add language info.
- Consider adding a starter template. If you do, add it to the list of starter templates in docs, command menu and language info.
- Add end-to-ends tests.
- Add language documentation.
- Add language to documentation website slider.
- Add compiler/formatter license(s).
- Update language count badge in README.