Holiday is over, now I have fun again. No code changes. (0.38.11)
This commit is contained in:
parent
f896e1d3bf
commit
15082bdc3e
9 changed files with 78 additions and 78 deletions
|
|
@ -4,36 +4,36 @@ This file serves as an index of the documents in this directory. Links are relat
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
- [handbook.md](./handbook.md) — Comprehensive handbook for the Fun language and VM: install/build, configuration flags, usage, and full feature overview.
|
- [handbook.md](./handbook.md) - Comprehensive handbook for the Fun language and VM: install/build, configuration flags, usage, and full feature overview.
|
||||||
- [types.md](./types.md) — Core types (numbers, strings, arrays, maps, nil/bool), common operations, patterns, and interop notes.
|
- [types.md](./types.md) - Core types (numbers, strings, arrays, maps, nil/bool), common operations, patterns, and interop notes.
|
||||||
- [numbers.md](./numbers.md) — Working with integers and floats: arithmetic, conversions, clamping, bitwise ops, and patterns.
|
- [numbers.md](./numbers.md) - Working with integers and floats: arithmetic, conversions, clamping, bitwise ops, and patterns.
|
||||||
- [strings.md](./strings.md) — Working with strings: literals/escaping, concatenation, substr/find, split, and conversions.
|
- [strings.md](./strings.md) - Working with strings: literals/escaping, concatenation, substr/find, split, and conversions.
|
||||||
- [arrays.md](./arrays.md) — Working with arrays: creation, indexing/slicing, iteration patterns, helpers, and idioms.
|
- [arrays.md](./arrays.md) - Working with arrays: creation, indexing/slicing, iteration patterns, helpers, and idioms.
|
||||||
- [maps.md](./maps.md) — Working with maps: construction, lookup/update, merging, iteration, and common patterns.
|
- [maps.md](./maps.md) - Working with maps: construction, lookup/update, merging, iteration, and common patterns.
|
||||||
- [includes.md](./includes.md) — Using local vs. system includes, FUN_LIB_DIR, DEFAULT_LIB_DIR, and namespaced includes with `as`.
|
- [includes.md](./includes.md) - Using local vs. system includes, FUN_LIB_DIR, DEFAULT_LIB_DIR, and namespaced includes with `as`.
|
||||||
- [repl.md](./repl.md) — REPL guide: how to build/launch, editing and history, completions, REPL‑on‑error, and tips.
|
- [repl.md](./repl.md) - REPL guide: how to build/launch, editing and history, completions, REPL-on-error, and tips.
|
||||||
- [opcodes.md](./opcodes.md) — VM opcodes overview grouped by domain with brief behavior/stack notes.
|
- [opcodes.md](./opcodes.md) - VM opcodes overview grouped by domain with brief behavior/stack notes.
|
||||||
- [internals.md](./internals.md) — Implementation details: bytecode format, VM architecture, stacks/frames, parser, and dispatch.
|
- [internals.md](./internals.md) - Implementation details: bytecode format, VM architecture, stacks/frames, parser, and dispatch.
|
||||||
- [rust.md](./rust.md) — Writing Rust‑backed opcodes and wiring them into the C VM; build/setup notes.
|
- [rust.md](./rust.md) - Writing Rust-backed opcodes and wiring them into the C VM; build/setup notes.
|
||||||
- [examples.md](./examples.md) — How to run the examples and the interactive showcase script, with environment tips.
|
- [examples.md](./examples.md) - How to run the examples and the interactive showcase script, with environment tips.
|
||||||
- [testing.md](./testing.md) — How to build and run tests/targets with CMake/CTest, and where to add new tests.
|
- [testing.md](./testing.md) - How to build and run tests/targets with CMake/CTest, and where to add new tests.
|
||||||
- [troubleshooting.md](./troubleshooting.md) — Common issues and quick fixes for build, includes, and REPL usage.
|
- [troubleshooting.md](./troubleshooting.md) - Common issues and quick fixes for build, includes, and REPL usage.
|
||||||
|
|
||||||
## New and supplemental guides
|
## New and supplemental guides
|
||||||
|
|
||||||
- [build.md](./build.md) — How to build Fun with CMake, available targets, and build options (FUN_DEBUG, FUN_USE_MUSL, FUN_WITH_CPP, FUN_WITH_RUST).
|
- [build.md](./build.md) - How to build Fun with CMake, available targets, and build options (FUN_DEBUG, FUN_USE_MUSL, FUN_WITH_CPP, FUN_WITH_RUST).
|
||||||
- [cli.md](./cli.md) — Command‑line usage of the `fun` executable: synopsis, options, exit codes, includes and library paths.
|
- [cli.md](./cli.md) - Command-line usage of the `fun` executable: synopsis, options, exit codes, includes and library paths.
|
||||||
- [contributing.md](./contributing.md) — How to contribute: project structure, coding style, running tests, and PR guidelines.
|
- [contributing.md](./contributing.md) - How to contribute: project structure, coding style, running tests, and PR guidelines.
|
||||||
- [style-guide.md](./style-guide.md) — Coding conventions for C and Fun (indentation, naming, idioms).
|
- [style-guide.md](./style-guide.md) - Coding conventions for C and Fun (indentation, naming, idioms).
|
||||||
- [stdlib.md](./stdlib.md) — Overview of the standard library modules under ./lib with one‑line summaries.
|
- [stdlib.md](./stdlib.md) - Overview of the standard library modules under ./lib with one-line summaries.
|
||||||
- [embedding.md](./embedding.md) — Embedding the VM from C/Rust, lifecycle, and host integration tips.
|
- [embedding.md](./embedding.md) - Embedding the VM from C/Rust, lifecycle, and host integration tips.
|
||||||
- [errors-and-diagnostics.md](./errors-and-diagnostics.md) — Understanding parser/runtime errors and enabling diagnostics.
|
- [errors-and-diagnostics.md](./errors-and-diagnostics.md) - Understanding parser/runtime errors and enabling diagnostics.
|
||||||
- [performance.md](./performance.md) — Build/runtime tuning tips and patterns for better performance.
|
- [performance.md](./performance.md) - Build/runtime tuning tips and patterns for better performance.
|
||||||
- [security-and-sandboxing.md](./security-and-sandboxing.md) — Trust boundaries, I/O expectations, and capability restrictions.
|
- [security-and-sandboxing.md](./security-and-sandboxing.md) - Trust boundaries, I/O expectations, and capability restrictions.
|
||||||
- [faq.md](./faq.md) — Frequently asked questions and quick answers.
|
- [faq.md](./faq.md) - Frequently asked questions and quick answers.
|
||||||
- [writing-tests.md](./writing-tests.md) — How to author new tests for Fun and opcode components.
|
- [writing-tests.md](./writing-tests.md) - How to author new tests for Fun and opcode components.
|
||||||
- [bytecode-format.md](./bytecode-format.md) — Reference for the bytecode format (split out from internals for convenience).
|
- [bytecode-format.md](./bytecode-format.md) - Reference for the bytecode format (split out from internals for convenience).
|
||||||
- [roadmap.md](./roadmap.md) — High‑level direction, planned features, and pointers to issues.
|
- [roadmap.md](./roadmap.md) - High-level direction, planned features, and pointers to issues.
|
||||||
|
|
||||||
## Tips
|
## Tips
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Bytecode Format (Overview)
|
# Bytecode Format (Overview)
|
||||||
|
|
||||||
This document summarizes the Fun bytecode format. For deep VM details, see `docs/internals.md`.
|
This document summarizes the Fun bytecode format. For deep VM details, see [internals.md](./internals.md).
|
||||||
|
|
||||||
## Goals
|
## Goals
|
||||||
- Compact representation for fast loading and dispatch
|
- Compact representation for fast loading and dispatch
|
||||||
|
|
@ -25,5 +25,5 @@ This document summarizes the Fun bytecode format. For deep VM details, see `docs
|
||||||
- Operands encoded inline following the opcode (width varies by instruction).
|
- Operands encoded inline following the opcode (width varies by instruction).
|
||||||
|
|
||||||
## Versioning and compatibility
|
## Versioning and compatibility
|
||||||
- The header’s version field allows the VM to refuse or translate older/newer formats.
|
- The header's version field allows the VM to refuse or translate older/newer formats.
|
||||||
- Keep additions backward-compatible when possible by appending sections or flags.
|
- Keep additions backward-compatible when possible by appending sections or flags.
|
||||||
|
|
|
||||||
18
docs/cli.md
18
docs/cli.md
|
|
@ -7,24 +7,24 @@ Reference for the `fun` command-line interface.
|
||||||
fun [options] <script.fun> [-- args...]
|
fun [options] <script.fun> [-- args...]
|
||||||
```
|
```
|
||||||
|
|
||||||
If no script is supplied and interactive mode is available, `fun` starts a REPL (see `docs/repl.md`).
|
If no script is supplied and interactive mode is available, `fun` starts a REPL (see [repl.md](./repl.md)).
|
||||||
|
|
||||||
## Common options
|
## Common options
|
||||||
- `-i`, `--repl` — start an interactive REPL
|
- `-i`, `--repl` - start an interactive REPL
|
||||||
- `-v`, `--version` — print version and exit
|
- `-v`, `--version` - print version and exit
|
||||||
- `-h`, `--help` — show help and exit
|
- `-h`, `--help` - show help and exit
|
||||||
|
|
||||||
Options may vary between versions; run `fun --help` to see what your build supports.
|
Options may vary between versions; run `fun --help` to see what your build supports.
|
||||||
|
|
||||||
## Exit codes
|
## Exit codes
|
||||||
- `0` — success
|
- `0` - success
|
||||||
- non-zero — error during parse, compile, or runtime
|
- non-zero - error during parse, compile, or runtime
|
||||||
|
|
||||||
## Includes and library paths
|
## Includes and library paths
|
||||||
- `FUN_LIB_DIR` — environment variable that points to the stdlib location; when running from the repo, set this to `./lib`.
|
- `FUN_LIB_DIR` - environment variable that points to the stdlib location; when running from the repo, set this to `./lib`.
|
||||||
- `DEFAULT_LIB_DIR` — compiled-in fallback path determined at build/install time.
|
- `DEFAULT_LIB_DIR` - compiled-in fallback path determined at build/install time.
|
||||||
|
|
||||||
See also: `docs/includes.md` for namespaced includes and search order.
|
See also: [includes.md](./includes.md) for namespaced includes and search order.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
Run a script:
|
Run a script:
|
||||||
|
|
|
||||||
|
|
@ -3,25 +3,25 @@
|
||||||
Thanks for your interest in contributing! This guide covers the basics to get you productive quickly.
|
Thanks for your interest in contributing! This guide covers the basics to get you productive quickly.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
- Clone the repo and build (see `docs/build.md`).
|
- Clone the repo and build (see [build.md](./build.md)).
|
||||||
- Run tests locally (see `docs/testing.md`).
|
- Run tests locally (see [testing.md](./testing.md)).
|
||||||
- Explore examples (see `docs/examples.md`).
|
- Explore examples (see [examples.md](./examples.md)).
|
||||||
|
|
||||||
## Project structure
|
## Project structure
|
||||||
- `src/` — C core, VM, and opcode implementations (`src/vm/*`).
|
- `src/` - C core, VM, and opcode implementations ([src/vm](../src/vm/)).
|
||||||
- `lib/` — Standard library written in Fun.
|
- `lib/` - Standard library written in Fun.
|
||||||
- `examples/` — Example programs and showcases.
|
- `examples/` - Example programs and showcases.
|
||||||
- `docs/` — Documentation.
|
- `docs/` - Documentation.
|
||||||
- `spec/` — Language specification drafts.
|
- `spec/` - Language specification drafts.
|
||||||
|
|
||||||
## Code style
|
## Code style
|
||||||
- C: C99, two-space indent, no tabs. Keep functions short and focused.
|
- C: C99, two-space indent, no tabs. Keep functions short and focused.
|
||||||
- Fun: two-space indent, snake_case for functions, PascalCase for classes/constructors.
|
- Fun: two-space indent, snake_case for functions, PascalCase for classes/constructors.
|
||||||
- Prefer clear names over abbreviations. See `docs/style-guide.md`.
|
- Prefer clear names over abbreviations. See [style-guide.md](./style-guide.md).
|
||||||
|
|
||||||
## Development workflow
|
## Development workflow
|
||||||
1. Create a small, focused branch.
|
1. Create a small, focused branch.
|
||||||
2. Add/adjust tests for behavior changes (see `docs/writing-tests.md`).
|
2. Add/adjust tests for behavior changes (see [writing-tests.md](./writing-tests.md)).
|
||||||
3. Update docs if user-visible behavior changes.
|
3. Update docs if user-visible behavior changes.
|
||||||
4. Submit a PR with a clear description and rationale.
|
4. Submit a PR with a clear description and rationale.
|
||||||
|
|
||||||
|
|
@ -37,4 +37,4 @@ Please include:
|
||||||
- `fun --version` output
|
- `fun --version` output
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
Be respectful and inclusive. See `CODE_OF_CONDUCT.md` in the repository root.
|
Be respectful and inclusive. See [CODE_OF_CONDUCT.md](../CODE_OF_CONDUCT.md) in the repository root.
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
This guide outlines how to embed the Fun VM in a host application and extend it from C/Rust.
|
This guide outlines how to embed the Fun VM in a host application and extend it from C/Rust.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
- The VM is implemented in C (see `src/vm/`).
|
- The VM is implemented in C (see [src/vm](../src/vm/)).
|
||||||
- Optional Rust-based opcodes can be enabled via `FUN_WITH_RUST` (see `docs/rust.md`).
|
- Optional Rust-based opcodes can be enabled via `FUN_WITH_RUST` (see [rust.md](./rust.md)).
|
||||||
|
|
||||||
## Embedding from C
|
## Embedding from C
|
||||||
While the exact API surface may evolve, a typical embedding flow looks like:
|
While the exact API surface may evolve, a typical embedding flow looks like:
|
||||||
|
|
@ -14,7 +14,7 @@ While the exact API surface may evolve, a typical embedding flow looks like:
|
||||||
4. Execute entry function or script body.
|
4. Execute entry function or script body.
|
||||||
5. Retrieve results and clean up.
|
5. Retrieve results and clean up.
|
||||||
|
|
||||||
See `src/vm/core` and related headers for public entry points and value types.
|
See [src/vm/core](../src/vm/core/) and related headers for public entry points and value types.
|
||||||
|
|
||||||
### Hosting considerations
|
### Hosting considerations
|
||||||
- Threading: share VM state cautiously or create one VM per thread.
|
- Threading: share VM state cautiously or create one VM per thread.
|
||||||
|
|
@ -22,8 +22,8 @@ See `src/vm/core` and related headers for public entry points and value types.
|
||||||
- Errors: propagate parse/runtime errors back to the host with useful messages.
|
- Errors: propagate parse/runtime errors back to the host with useful messages.
|
||||||
|
|
||||||
## Extending with Rust
|
## Extending with Rust
|
||||||
When `FUN_WITH_RUST=ON`, a Rust static library from `src/rust/` is built and linked. You can:
|
When `FUN_WITH_RUST=ON`, a Rust static library from [`src/rust/`](../src/rust/) is built and linked. You can:
|
||||||
- Implement new opcodes/functions in Rust.
|
- Implement new opcodes/functions in Rust.
|
||||||
- Expose a C ABI for the VM to call into.
|
- Expose a C ABI for the VM to call into.
|
||||||
|
|
||||||
See `docs/rust.md` for details and example code.
|
See [rust.md](./rust.md) for details and example code.
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ This guide helps you understand common error messages and how to collect useful
|
||||||
- Runtime errors: type mismatches, out-of-range access, invalid operations.
|
- Runtime errors: type mismatches, out-of-range access, invalid operations.
|
||||||
|
|
||||||
## Enabling diagnostics
|
## Enabling diagnostics
|
||||||
- Build with `-DFUN_DEBUG=ON` to enable additional assertions and debug messages (see `docs/build.md`).
|
- Build with `-DFUN_DEBUG=ON` to enable additional assertions and debug messages (see [build.md](./build.md)).
|
||||||
- Run with smaller, focused scripts to isolate issues.
|
- Run with smaller, focused scripts to isolate issues.
|
||||||
|
|
||||||
## Getting useful reports
|
## Getting useful reports
|
||||||
|
|
|
||||||
14
docs/faq.md
14
docs/faq.md
|
|
@ -2,21 +2,21 @@
|
||||||
|
|
||||||
Answers to common questions.
|
Answers to common questions.
|
||||||
|
|
||||||
## I built Fun but includes aren’t found
|
## I built Fun but includes aren't found
|
||||||
Set `FUN_LIB_DIR` to the repository’s `./lib` directory when running without installation:
|
Set `FUN_LIB_DIR` to the repository's `./lib` directory when running without installation:
|
||||||
```
|
```
|
||||||
FUN_LIB_DIR=./lib ./build_debug/fun examples/hello.fun
|
FUN_LIB_DIR=./lib ./build_debug/fun examples/hello.fun
|
||||||
```
|
```
|
||||||
See `docs/includes.md`.
|
See [includes.md](./includes.md).
|
||||||
|
|
||||||
## How do I start the REPL?
|
## How do I start the REPL?
|
||||||
Run `fun -i` (or run `fun` without a script, depending on version). See `docs/repl.md`.
|
Run `fun -i` (or run `fun` without a script, depending on version). See [repl.md](./repl.md).
|
||||||
|
|
||||||
## Which build target should I use?
|
## Which build target should I use?
|
||||||
Use the aggregate `build` target to build `fun`, `fun_test`, and `test_opcodes`. See `docs/build.md`.
|
Use the aggregate `build` target to build `fun`, `fun_test`, and `test_opcodes`. See [build.md](./build.md).
|
||||||
|
|
||||||
## Where are the standard libraries?
|
## Where are the standard libraries?
|
||||||
Under `./lib/`. See `docs/stdlib.md` for an overview.
|
Under [`./lib/`](../lib/). See [stdlib.md](./stdlib.md) for an overview.
|
||||||
|
|
||||||
## Where can I find internals and opcodes?
|
## Where can I find internals and opcodes?
|
||||||
Browse `src/vm/` and `docs/internals.md` / `docs/opcodes.md`.
|
Browse [src/vm](../src/vm/) and [internals.md](./internals.md) / [opcodes.md](./opcodes.md).
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ This page outlines high-level areas of focus and points to places where you can
|
||||||
- Safety: clearer error messages, diagnostics, and sandboxing guidance
|
- Safety: clearer error messages, diagnostics, and sandboxing guidance
|
||||||
|
|
||||||
## Near-term
|
## Near-term
|
||||||
- Expand CLI reference and examples (`docs/cli.md`)
|
- Expand CLI reference and examples ([cli.md](./cli.md))
|
||||||
- Improve testing docs and coverage (`docs/writing-tests.md`)
|
- Improve testing docs and coverage ([writing-tests.md](./writing-tests.md))
|
||||||
- Fill gaps in stdlib documentation (`docs/stdlib.md`)
|
- Fill gaps in stdlib documentation ([stdlib.md](./stdlib.md))
|
||||||
|
|
||||||
## Medium-term
|
## Medium-term
|
||||||
- Bytecode/reference updates as internals evolve (`docs/bytecode-format.md`, `docs/internals.md`)
|
- Bytecode/reference updates as internals evolve ([bytecode-format.md](./bytecode-format.md), [internals.md](./internals.md))
|
||||||
- Embedding guides and host API stability (`docs/embedding.md`, `docs/rust.md`)
|
- Embedding guides and host API stability ([embedding.md](./embedding.md), [rust.md](./rust.md))
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
See `docs/contributing.md` for how to propose and implement items. Track concrete tasks via repository issues and PRs.
|
See [contributing.md](./contributing.md) for how to propose and implement items. Track concrete tasks via repository issues and PRs.
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
# Standard Library Overview
|
# Standard Library Overview
|
||||||
|
|
||||||
This page provides a quick orientation to the standard library located under `./lib/`.
|
This page provides a quick orientation to the standard library located under [`./lib/`](../lib/).
|
||||||
|
|
||||||
The stdlib is written in Fun and organized by domain. Below are top-level modules and what they generally cover. Refer to the source for full APIs and examples.
|
The stdlib is written in Fun and organized by domain. Below are top-level modules and what they generally cover. Refer to the source for full APIs and examples.
|
||||||
|
|
||||||
## Module index (selected)
|
## Module index (selected)
|
||||||
- `crypt/` — cryptographic helpers (hashing, encoding helpers). See also `lib/crypt`.
|
- `crypt/` - cryptographic helpers (hashing, encoding helpers). See also [lib/crypt](../lib/crypt/).
|
||||||
- `encoding/` — text/binary encodings and conversions.
|
- `encoding/` - text/binary encodings and conversions.
|
||||||
- `io/` — file and stream utilities.
|
- `io/` - file and stream utilities.
|
||||||
- `net/` — basic networking helpers.
|
- `net/` - basic networking helpers.
|
||||||
- `regex/` — regular expression utilities (PCRE2 when available).
|
- `regex/` - regular expression utilities (PCRE2 when available).
|
||||||
- `ui/` — UI helpers (e.g., Tk if enabled at build time).
|
- `ui/` - UI helpers (e.g., Tk if enabled at build time).
|
||||||
- `utils/` — small reusable helpers and utilities.
|
- `utils/` - small reusable helpers and utilities.
|
||||||
|
|
||||||
Note: Availability of some modules can depend on optional extensions selected at build time (see `docs/build.md`).
|
Note: Availability of some modules can depend on optional extensions selected at build time (see [build.md](./build.md)).
|
||||||
|
|
||||||
## Using modules
|
## Using modules
|
||||||
```fun
|
```fun
|
||||||
|
|
@ -23,4 +23,4 @@ let s = strings.trim(" hello ")
|
||||||
print(s)
|
print(s)
|
||||||
```
|
```
|
||||||
|
|
||||||
For search paths and namespacing details, see `docs/includes.md` and `docs/cli.md` (FUN_LIB_DIR and DEFAULT_LIB_DIR).
|
For search paths and namespacing details, see [includes.md](./includes.md) and [cli.md](./cli.md) (FUN_LIB_DIR and DEFAULT_LIB_DIR).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue