How omdxp/fun works
Fun is a self-hosted, statically typed language compiler that lowers Fun programs to C, alongside a standard library, language server, editor integrations, and an interactive reference site. The main workflow is a developer invoking the CLI on Fun source, which is compiled through lexical, syntactic, semantic, and code-generation stages before native compilation and execution. The README documents these compiler stages and product capabilities; sampled source confirms the reference playground invokes the compiler and VS Code launches the language server. Internal links beyond the sampled excerpts follow documented structure and are limited to the evident compiler pipeline.
Main entry points: main.fn Fun CLI · parser.fn Parser · driver.fn Compile Driver · lexer.fn Lexer
Components 19
Compiler
- Fun CLI
src/cli/main.fn - Compile Driver
src/cli/driver.fn - Lexer
src/lexer/lexer.fn - Parser
src/parser/parser.fn - Import Resolution
src/parser/import_resolver.fn - Type Checking
src/semantics/typecheck.fn - C Code Generation
src/codegen/codegen.fn
Developer Tooling
- Fun Language Server
src/fls/main.fn
Standard Library
- Fun Standard Library
stdlib/std/prelude.fn
Editor Integrations
- VS Code Extension
editors/vscode/src/extension.ts - Other Editor Support
editors
Reference Site
- Reference App
website/reference/src/App.tsx - Runnable Docs
website/reference/src/components/MarkdownWithPlayground.tsx - Code Playground
website/reference/src/components/RunCodeBlock.tsx - Playground Server
website/reference/server/index.ts
Other components
- Developer
- Fun Source
- C Compiler
- Native Program
Connections 20
- Developer → Fun Source: writes
- Developer → Fun CLI: runs
- Fun Source → Fun CLI: provides input
- Fun CLI → Compile Driver: dispatches
- Compile Driver → Lexer: lexes
- Lexer → Parser: tokens
- Parser → Import Resolution: resolves imports
- Parser → Type Checking: checks
- Type Checking → C Code Generation: typed program
- C Code Generation → C Compiler: emits C
- C Compiler → Native Program: builds
- Native Program → Fun Standard Library: uses modules
- Developer → VS Code Extension: edits code
- VS Code Extension → Fun Language Server: launches
- Developer → Other Editor Support: edits code
- Developer → Reference App: browses
- Reference App → Runnable Docs: renders docs
- Runnable Docs → Code Playground: renders runnable blocks
- Code Playground → Playground Server: posts code
- Playground Server → Fun CLI: runs compiler