A natural-language-like programming language that compiles to native code via LLVM.
- Pattern-based syntax that reads like English
- Compiles to native executables via LLVM
- Static typing with full type inference
- Standard library written in DynLex itself
- VS Code extension with LSP support
./scripts/build.shRequires C++23, Clang 20 or newer, CMake, Ninja, nlohmann_json, Git, and GNU
binutils on ELF systems. scripts/build.sh checks out and caches the exact LLVM
23 fork recorded in metadata/LLVM_TOOLCHAIN; system LLVM installations are not
used. Linked Git worktrees automatically share the primary checkout's
.cache/llvm-toolchain directory. Set DYNLEX_LLVM_CACHE_DIR to use an explicit
cache location instead. Build that toolchain independently with:
./scripts/build_llvm.sh nativeThe normal build uses -O2 while retaining debug information and compiler
invariants. Use ./scripts/build.sh --debug when an unoptimized executable is
needed for source-level debugging.
DynLex can be built as a browser-hosted compiler module (dynlex_web.js/.wasm) with a Monaco-based web UI.
This target requires Emscripten (emcmake, emcc). The build compiles and
caches a WebAssembly version of the same pinned LLVM fork with the WebAssembly
and SPIR-V targets.
The build fetches its pinned SPIRV-Cross revision and links the GLSL translator into the compiler module.
Build compiler WASM artifacts and copy them into the web app:
source ~/emsdk/emsdk_env.sh
./scripts/build_web.shThe build script uses the active Emscripten SDK and builds the exact web LLVM
toolchain recorded in metadata/LLVM_TOOLCHAIN.
./scripts/build_web.sh refreshes src/web/ide/public/compiler/dynlex_web.js and
src/web/ide/public/compiler/dynlex_web.wasm; commit those files when updating the deployed web compiler.
Run the compiler WASM smoke test:
./scripts/test_web_smoke.shRun the web app:
cd src/web/ide
npm install
npm run devRefresh the deployable static web root (web/) after IDE changes:
./scripts/build_web_root.shView the deployable web site (web/) locally and open it in your browser:
./scripts/view_web.shWeb layout:
src/web/ide/: IDE source (Vite + Monaco)web/: deployable web root (site/wiki source + built IDE assets)
The web app uses:
- one editable
/workspace/*.dlentry file plus read-only imported definitions - bundled stdlib from
/lib/*.dlin Emscripten virtual FS - live debounced compile with diagnostics published by the DynLex language server
- one persistent DynLex LSP session for completion, hover, go-to-definition, semantic tokens, document symbols, quick fixes, and DynLex instantiation selection
- live WebGL2 previews for DynLex fragment/vertex shaders opened from the homepage shader gallery
- built-in light and dark themes
Runexecuting the latest successful emitted program WASM
Compiler WASM C ABI exports:
dynlex_web_initdynlex_web_set_main_sourcedynlex_web_compile_and_emit_wasmdynlex_web_compile_and_emit_shader_glsldynlex_web_get_diagnostics_jsondynlex_web_get_output_wasm_ptr/dynlex_web_get_output_wasm_lendynlex_web_get_output_wasm_base64dynlex_web_get_output_shader_glsldynlex_web_get_shader_uniforms_jsondynlex_web_get_compiler_log_jsondynlex_web_lsp_exchange_json
Linux (apt/dnf/pacman/zypper):
./scripts/install.shmacOS (Homebrew):
./scripts/install.sh
if brew info llvm@20 >/dev/null 2>&1; then
export PATH="$(brew --prefix llvm@20)/bin:$PATH"
else
export PATH="$(brew --prefix llvm)/bin:$PATH"
fi
export LIBRARY_PATH="$(brew --prefix glfw)/lib:$(brew --prefix freetype)/lib:$(brew --prefix)/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"The installer reuses tools already available on PATH and installs missing
Homebrew formulae without upgrading unrelated installed packages. The Homebrew
LLVM formula supplies the bootstrap Clang only; DynLex links the pinned fork
built by scripts/build_llvm.sh.
Windows (winget):
.\scripts\install.ps1The Windows installer also installs nlohmann_json through vcpkg and exports
the package paths used by scripts/build.sh.
Compile a source file:
./build/dynlex program.dl -o program.out && ./program.outOr execute DynLex source directly. Command-line source automatically imports
lib/commands.dl, which provides the standard library and command-oriented
libraries such as file operations:
./build/dynlex print 3
./build/dynlex 'move "a.txt" to "b.txt"'The outer single quotes in the second example preserve DynLex's string quotes when the source passes through the shell.
Compiler/release version source of truth is metadata/VERSION.
Create and push a release tag with automatic version bump:
./scripts/release.sh patch # or: minor, major, set X.Y.ZFor sanitizer leak checks that ignore known process-lifetime allocations from third-party libraries (for example LLVM internals), use:
./scripts/asan_leak_check.shBy default this runs build-asan/dynlex with scripts/lsan.supp.
Benchmark details, reproducible source programs, compiler settings, and hardware-specific results:
Times are hardware- and toolchain-dependent; run the benchmark files locally for your exact environment.
Launchpad packaging lives in packaging/launchpad. Use
that directory for Debian metadata, source-package builds, and PPA publishing so
the project root stays focused on the compiler itself.