Skip to content

New model of .gs, a new programming language in a box using javascript.

Notifications You must be signed in to change notification settings

iSev7n/Genesis-Script-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Genesis Script V2 (secure refactor)

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.


What changed (high level)

1) Clear module boundaries

  • 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

2) Safety guardrails

  • 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

3) Human-quality details

  • 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

Example

create name as "World"

command greet(who)
  bless "Hello, " + who
end

reveal greet(name)

Output:

Hello, World

Run

node cli/run-gs.js examples/hello.gs

REPL

node cli/repl.js

Transpile

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

Project Structure

  • 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

Language Design

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

Language Features (vNext)

Explicit conversions

to_number("12")
to_text(12)

Arrays

create x as nums[0]
length(nums)

Modules

scroll "std.gs"
scroll "std.gs" as std
  • Namespaced modules are cached and immutable
  • Legacy scroll merges into the current scope

Tests + fuzzing

npm test

Runs golden parser tests, golden runtime tests, and tokenizer/parser fuzz testing.


Status

Genesis Script is an evolving project.
Syntax and features may change as the language matures.


License

MIT License

About

New model of .gs, a new programming language in a box using javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published