{"id":51242518,"url":"https://github.com/arturoeanton/go-turbo-pascal","last_synced_at":"2026-06-29T01:31:01.621Z","repository":{"id":365796008,"uuid":"1271702116","full_name":"arturoeanton/go-turbo-pascal","owner":"arturoeanton","description":"An embeddable, strongly-typed Pascal engine for Go — plus a clean-room Turbo Pascal 7","archived":false,"fork":false,"pushed_at":"2026-06-18T23:23:01.000Z","size":8457,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T00:21:04.900Z","etag":null,"topics":["delphi","embedded-pascal","embedded-scripting","go-embed","pascal","pascal-programming"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arturoeanton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-16T23:50:01.000Z","updated_at":"2026-06-18T23:23:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/arturoeanton/go-turbo-pascal","commit_stats":null,"previous_names":["arturoeanton/go-turbo-pascal"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/arturoeanton/go-turbo-pascal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturoeanton%2Fgo-turbo-pascal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturoeanton%2Fgo-turbo-pascal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturoeanton%2Fgo-turbo-pascal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturoeanton%2Fgo-turbo-pascal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arturoeanton","download_url":"https://codeload.github.com/arturoeanton/go-turbo-pascal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturoeanton%2Fgo-turbo-pascal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34910177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delphi","embedded-pascal","embedded-scripting","go-embed","pascal","pascal-programming"],"created_at":"2026-06-29T01:31:00.924Z","updated_at":"2026-06-29T01:31:01.604Z","avatar_url":"https://github.com/arturoeanton.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-turbo-pascal\n\n**An embeddable, strongly-typed Pascal engine for Go — plus a clean-room Turbo Pascal 7 toolchain.**\n\n`go-turbo-pascal` lets you run real Pascal *inside* a Go program through the\n[`pkg/vmpas`](pkg/vmpas) library, and ships modern editor tooling (LSP + DAP)\nfor `.pas` files. The compiler front-end and bytecode VM are a clean-room\nimplementation: no Borland binary, source, or documentation is embedded.\n\n[![CI](https://github.com/arturoeanton/go-turbo-pascal/actions/workflows/ci.yml/badge.svg)](https://github.com/arturoeanton/go-turbo-pascal/actions/workflows/ci.yml)\n\u0026nbsp;·\u0026nbsp; [![Go Reference](https://pkg.go.dev/badge/github.com/arturoeanton/go-turbo-pascal/pkg/vmpas.svg)](https://pkg.go.dev/github.com/arturoeanton/go-turbo-pascal/pkg/vmpas)\n\u0026nbsp;·\u0026nbsp; Go 1.23+ \u0026nbsp;·\u0026nbsp; MIT licensed \u0026nbsp;·\u0026nbsp; `pkg/vmpas` has **zero external dependencies**\n\n```bash\ngo get github.com/arturoeanton/go-turbo-pascal/pkg/vmpas\n```\n\n📖 **Documentation:** [🇬🇧 English](docs/en/README.md) · [🇪🇸 Español](docs/es/README.md) · [Examples](examples/README.md)\n\n---\n\n## Why embed Pascal?\n\n`pkg/vmpas` is an embeddable scripting engine in the spirit of the popular\nJavaScript and Lua engines for Go — but for Pascal, and **strongly typed**. It\ncompiles and type-checks the whole program **before the first instruction runs**,\nso a class of errors that dynamic engines only surface at runtime is caught up\nfront.\n\nWhat you get:\n\n- **Strong typing, checked ahead of time** — the program is compiled to bytecode\n  and type-checked before execution, not interpreted off the AST.\n- **Two-way Go ↔ Pascal binding** — expose Go variables (`Var`), call Go\n  functions from Pascal (`Function`/`Process`), and map Go structs to Pascal\n  records.\n- **A capability sandbox (default-deny)** — file system, network, process\n  execution, environment and database access are all off unless you opt in,\n  with step/heap/output/time limits on top.\n- **Durable execution** — a running program can be deterministically snapshotted,\n  persisted, and resumed later (even on another machine). See\n  [durable execution](docs/en/durable.md).\n- **Capability inference \u0026 audit** — statically discover which capabilities a\n  script needs before running it, and get an audit log of every gated call.\n- **Zero dependencies** — embedding Pascal never pulls anything into your build;\n  a test enforces it.\n\n## When vmpas is the right fit\n\nThere are excellent embeddable engines in Go already, and for many projects one\nof those is the right call. vmpas focuses on a specific combination that is\notherwise hard to assemble in one place:\n\n\u003e **Pascal + ahead-of-time type checking + a capability sandbox + deterministic,\n\u003e resumable execution + zero dependencies.**\n\nReach for it when you need to:\n\n- **Pause, persist and resume** an execution deterministically and auditably —\n  e.g. long-running workflows, step-through approvals, or migrating a computation\n  between machines (see [durable execution](docs/en/durable.md)).\n- Run **untrusted or per-tenant code** under a default-deny capability sandbox\n  with hard resource limits (see [security](docs/en/security.md)).\n- Embed a **strongly typed** language whose errors surface at compile time, not\n  mid-run.\n- Bring **Pascal** to a Go service — for legacy TP7 logic, domain rules authored\n  in Pascal, or teaching.\n\nIf raw single-threaded throughput is your only metric, a mature JavaScript or Lua\nengine will likely be faster; vmpas trades a little speed for typing, isolation\nand durability. The honest numbers are in [status \u0026 benchmarks](docs/en/status.md).\n\n## Demo: a visual durable-workflow builder\n\nA small RAD app built on `pkg/vmpas` ([`examples/rad`](examples/rad)): drag boxes\nonto a canvas to compose a flow, where **each box is editable Pascal** and you can\ndefine your own reusable components. An **Approval** box uses durable execution —\nthe run **pauses** (`Suspend`), its state is persisted, and it **resumes** on a\nfresh engine after a human Approve/Reject. Boxes light up live as they execute\n(via a bound `Trace` callback), and flows, run history and paused state are stored\nin **SQLite**. Example boxes also show the Go↔Pascal **SQL** and **HTTP**\nintegration.\n\n![RAD durable workflow builder](screenshot/rad-workflow.png)\n\n```bash\ncd examples/rad \u0026\u0026 go run .   # then open http://localhost:8080\n```\n\n## Quickstart\n\nEmbed Pascal in Go ([`examples/embed`](examples/embed/main.go)):\n\n```go\nimport \"github.com/arturoeanton/go-turbo-pascal/pkg/vmpas\"\n\neng := vmpas.New()        // default: Restricted (no FS/net/exec)\ntotal := 10\neng.Var(\"total\", \u0026total)\neng.Run(`for i := 1 to 5 do total := total + i`)\n// total == 25\n```\n\n…and the part a generic scripting engine won't give you in one import — run\n**untrusted** code safely. A default-deny sandbox with hard limits stops a\nrunaway script instead of hanging your process:\n\n```go\nout, err := vmpas.RunSandboxed(`\n  program P; var i: Integer;\n  begin while true do i := i + 1 end.`, vmpas.Sandboxed())\n// out == \"\", err == *vmpas.RuntimeError (step/time limit) — the host keeps running\n```\n\nRun a `.pas` program on the engine:\n\n```bash\ngo run ./cmd/pasrun examples/pascal/factorial.pas\ngo run ./examples/embed\n```\n\nCompile once, run many times:\n\n```go\nscript, _ := eng.Compile(code)\nfor _, input := range inputs {\n    script.Run()\n}\n```\n\nMore: [Quickstart](docs/en/quickstart.md) ·\n[vmpas guide](docs/en/vmpas.md) ·\n[Durable execution](docs/en/durable.md) ·\n[Security \u0026 sandbox](docs/en/security.md) ·\n[TP7 compatibility](docs/en/compatibility.md) ·\n[FAQ](docs/en/faq.md).\n\n## Build and test\n\n```bash\ngo build ./...   # build everything\ngo test ./...    # run the full test suite\ngo vet ./...     # static checks\n```\n\n## What's in the box\n\n### `pkg/vmpas` — the embeddable engine\nThe library facade over the real compiler and VM. Bind Go values, call across\nthe Go ↔ Pascal boundary, sandbox capabilities, run durably. Zero external deps.\nThe public API is frozen and covered by a contract test — see\n[Public API and stability](docs/en/api.md).\n\n### Editor tooling\n| Command  | Description |\n|----------|-------------|\n| `pls`    | Pascal **language server** (LSP) — diagnostics, hover, completion, go-to-definition |\n| `pdap`   | Pascal **debug adapter** (DAP) — breakpoints, stepping, call stack, variables |\n| `bpgo`   | main CLI: compile \u0026 run (`bpgo --run x.pas`) plus `test-compat` |\n| `pasrun` | minimal \"compile \u0026 run a `.pas`\" driver |\n| `tpc`    | a TP7-compatible CLI wrapper around `bpgo` |\n| `tdebug` | source-level debugger CLI |\n\nEditor plugins live in [`editors/`](editors): **VSCode** (syntax + LSP +\ndebugging) and **Zed** (LSP). See [Editors](docs/en/editors.md).\n\n### The Pascal language\nTP7 procedural **and** OOP: procedures/functions (value/`var`/`const` params,\nrecursion), records, multidimensional arrays, sets, enums, subranges, pointers\n(`New`/`Dispose`/`^`/`@`), real `ShortString` and `Char`, full control flow,\n`object` types with constructors/destructors, inheritance and virtual methods\n(VMT dispatch), a real `uses` unit system, and text/typed file I/O. Modern\nextras: `match`/sum types/`Option`, `defer`/`panic`/`recover`, and\n`spawn`/channels.\n\nSee the [TP7 compatibility matrix](docs/en/compatibility.md) for exactly what is\nand isn't supported.\n\n## Architecture\n\n```\nPascal source\n  → internal/lexer    TP7 tokenizer\n  → internal/parser   recursive-descent parser → internal/ast\n  → internal/sem      semantic analysis \u0026 type system\n  → internal/codegen  bytecode generation\n  → internal/ir       bytecode VM (frames, records, arrays, sets, pointers,\n                       strings, OOP/VMT, file I/O, snapshot/resume)\n  → internal/rtl      RTL units (System, Crt, Dos, Strings, …) bound to the VM\n\nConsumers:\n  pkg/vmpas           Go facade: Var/Function/Process binding, sandbox, durable run\n  cmd/{bpgo,pasrun,tpc,tdebug}   CLIs over the same pipeline\n  cmd/{pls,pdap}      LSP / DAP servers (may have their own deps; vmpas stays clean)\n```\n\n[Full architecture](docs/en/architecture.md).\n\n## Quality\n\nFour test layers run on every change and in CI:\n\n- **Unit tests** per `internal/...` package, covering each language and runtime feature.\n- **End-to-end tests** (`internal/e2e`) exercising the full lex → parse → sem → codegen → VM pipeline over the `testdata/pas` corpus and the CLIs.\n- **Integration tests** (`internal/integration`) running RTL units through the full pipeline.\n- **Conformance tests** (`internal/conformance`) producing `compat/report.json`, a per-unit/-directive/-diagnostic compatibility report.\n\n## Scope and non-goals\n\nTo set honest expectations:\n\n- **Targeted:** embedding Pascal in Go, the TP7 language (procedural + OOP),\n  the RTL units listed above, deterministic durable execution, and editor tooling.\n- **Not targeted:** inline assembler, overlays, far pointers, real MZ EXE\n  generation, and DOS binary compatibility.\n- **Legacy / experimental:** `internal/tv` (Turbo Vision stubs) and the\n  `codegen8086`/`mz`/`omf` back-end are not on the main path. A nostalgic\n  TP7 TUI/IDE is not currently planned.\n\n## License\n\n[MIT](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturoeanton%2Fgo-turbo-pascal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farturoeanton%2Fgo-turbo-pascal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturoeanton%2Fgo-turbo-pascal/lists"}