Genesis Script is a small, beginner-friendly scripting language inspired by biblical terminology and designed for clarity, safety, and experimentation.
This repository contains a refactored, security-hardened version of the original genesis.gs, expanded into a full language toolchain with a tokenizer, parser, interpreter, transpiler, CLI tools, and tests.
Genesis Script files use the .gs extension.
- src/tokenizer.js – tokenization with line and column tracking
- src/parser.js – AST builder with friendly, location-aware parse errors
- src/runtime.js – sandboxed interpreter with execution limits and safe environments
- src/transpiler.js – deterministic transpiler with per-call state
- cli/* – thin, human-readable command-line tools and REPL
- scroll imports are constrained to a base directory (default: current working directory)
- Blocks .. traversal and absolute path escapes
- Execution step limit (default: 200,000) to reduce infinite-loop risk
- Import limits (default: 50 scrolls)
- Maximum file size limits for imported scripts
- Location-aware errors (file:line:col)
- No global mutable transpiler state (declaredVars is per transpile call)
- Beginner-friendly numeric coercion helpers
- Deterministic parsing and execution behavior
create name as "World"
command greet(who)
bless "Hello, " + who
end
reveal greet(name)
Output:
Hello, World
node cli/run-gs.js examples/hello.gs
node cli/repl.js
node cli/gs-to-js.js examples/hello.gs
node cli/gs-to-js.js examples/hello.gs --browser
node cli/gs-to-js.js examples/hello.gs --loose-eq
- src/ – Core language implementation (tokenizer, parser, runtime, transpiler)
- cli/ – Command-line tools and interactive REPL
- stdlib/ – Standard library Genesis Script files
- examples/ – Example .gs programs
- tests/ – Golden tests and fuzz testing
- docs/ – Language specification
Genesis Script is intentionally:
- Small
- Explicit
- Beginner-readable
- Safe to execute
Biblical terminology is used for thematic and educational purposes only.
The language is not a religious framework or doctrine.
The full language specification is available in:
- docs/language-spec.md
to_number("12")
to_text(12)
create x as nums[0]
length(nums)
scroll "std.gs"
scroll "std.gs" as std
- Namespaced modules are cached and immutable
- Legacy scroll merges into the current scope
npm test
Runs golden parser tests, golden runtime tests, and tokenizer/parser fuzz testing.
Genesis Script is an evolving project.
Syntax and features may change as the language matures.
MIT License