Examples
These 50 examples come directly from segfaultcafe/flecha. They cover the current language, runtime, standard library, and compiler diagnostics.
Language and control flow
Section titled “Language and control flow”- Hello
- Stdout
- Native Functions
- Numeric Casts
- Structures
- Tuples
- Const Declarations
- If Also
- While Also
- Iteration
- Loop Control
- Fixed Arrays
- String View
- Error Values
- Defer
- Callables
- Once
Memory and ownership
Section titled “Memory and ownership”- Checked References
- Checked Slices
- Ref And Slice Returns
- Ownership Contracts
- Raw Allocation
- Unsafe Pointers
- Memory Tracking
Standard library and compilation
Section titled “Standard library and compilation”- Callback Algorithms
- Standard library modules
- Generic dynamic array
- LLVM IR proof of concept
- Standard-library qualification program
- Standard-library public API fixture
- Standard-library public API tests
Complete applications
Section titled “Complete applications”- Workspace Guard commands
- Workspace Guard application
- Workspace Guard manifest
- Workspace Guard model
- Workspace Guard scanner
- Ledger commands
- Ledger canonical codec
- Ledger golden-vector tests
- Deterministic ledger application
- Ledger model
- Ledger storage
Compiler diagnostics
Section titled “Compiler diagnostics”- Invalids
- Checked References
- Checked Slices
- Compound Types
- Const Declarations
- Fixed Arrays
- Iteration
- Unsafe Pointers
Run an example
Section titled “Run an example”build/flecha check examples/hello.flbuild/flecha build examples/hello.fl -o build/hello./build/hello