Skip to main content

Osaka Programming Language CLI (interpreter + VM + equivalence lock)

Project description

OsakaProgrammingLanguage (Osaka Lang)

Osaka Lang is a custom programming language implemented in Python, with:

  • an AST interpreter
  • a bytecode compiler + VM
  • an Equivalence Lock to compare interpreter and VM behavior

You can run it from source (python3 saka.py) or as an installed CLI (osaka).


Quick Start

python3 saka.py examples/hello.saka
python3 saka.py --help

Main CLI flags

  • --no-lock — disable equivalence lock
  • --vm-only — execute only VM path
  • --interpreter-only — execute only interpreter path
  • --lock-strict — fail on lock mismatches
  • --warnings-as-errors — treat warnings as errors in equivalence checks
  • --debug — enable debug traces
  • --show-lexer-tokens — print lexer token stream
  • --repl — launch interactive Osaka REPL

Example:

python3 saka.py --show-lexer-tokens tests/equivalence/06_sataandagi.saka

Default mode now prints Say(...) program output directly. If a program emits no output, Osaka prints:

Tip: Use --debug for traces

Install CLI (osaka)

Install from local repo:

python3 -m pip install --upgrade "/Users/example/Desktop/Osaka Lang"

Or build a wheel:

cd "/Users/example/Desktop/Osaka Lang"
python3 -m pip wheel . --no-deps -w dist
python3 -m pip install --upgrade "dist/osakaprogramminglanguage-0.1.0-py3-none-any.whl"

Then:

osaka --help
osaka your_program.saka
osaka --repl

Language Guide

1) Declarations and kinds

Osaka Lang tracks value kinds:

  • grainsoftruthgrain (uncertain)
  • truthaboutgraintruth (authoritative)
grainsoftruth g = 11;
truthaboutgrain t = Americaya(g);
Say(t);

2) Control flow

if and while require truthaboutgrain conditions at runtime.

truthaboutgrain ok = 1;
if (ok == 1) {
    Say("ready");
}

If a condition evaluates to grain, runtime raises an error (for example: while-condition must be truthaboutgrain).

3) Functions

Both function and func are accepted.

func add(a, b) {
    return a + b;
}

truthaboutgrain x = add(2, 3);
Say(x);

Current interpreter rule: function parameters are bound as grain inside function scope unless promoted.

4) Collections

  • Lists: [1, 2, 3]
  • Maps: {"name": "SATA", "level": 6}
  • Indexing: arr[i], m["key"]
  • Index assignment: arr[i] = value;
truthaboutgrain nums = [1, 2];
push(nums, 3);
Say(nums);

truthaboutgrain profile = {"name": "SATA"};
Say(profile["name"]);

5) Mutation & governance built-ins

  • Ah(x) — acknowledges variable for mutation
  • youknowsealsright(x) — marks variable as assumed (suppresses mutation warning path)
  • Ivebeengot(x) — legacy protection (blocks later mutation)
  • Hecho(x) — freezes a variable when allowed

Typical behavior:

  • mutating an initialized variable without Ah/assumption can warn
  • mutating Hecho/Ivebeengot variables is blocked
  • Hecho on grainsoftruth emits advisory info in current runtime behavior

6) Runtime/system built-ins

  • Getittogether(); — stabilizes unresolved grain state
  • SataAndagi() — returns runtime info map as truth
  • Americaya(x) — promotes value to truth (returns promoted value)
grainsoftruth raw = 42;
Getittogether();
truthaboutgrain stable = Americaya(raw);
Say(stable);

7) Context progression statements

Parser accepts these as statement-style declarations:

Escalator reviewLevel2;
Elevator policyLevel;

Note: current parser rules treat Getittogether as a callable form with parentheses, while Escalator/Elevator are declaration-style statements.


Standard Library (currently implemented)

  • Say(x)
  • len(x)
  • push(list, value)
  • pop(list)
  • contains(map, key)
  • keys(map)
  • values(map)
  • slice(list_or_string, start, end)
  • SataAndagi()
  • Americaya(x)

Testing

Run a program through the main CLI:

python3 saka.py examples/hello.saka

Run direct interpreter-vs-VM equivalence harness:

python3 equiv_lock.py tests/equivalence/06_sataandagi.saka

Full test runner (project utility):

python3 run_tests.py

Single equivalence test:

python3 run_tests.py --filter 06_sataandagi.saka

Verifier unit tests:

python3 -m unittest tests/test_verifier.py

Implementation Map (contributors)

  • lexer.py — tokenization / keywords
  • parser.py — AST construction
  • ast_nodes.py — AST node types
  • interpreter.py — interpreter semantics
  • compiler.py, bytecode.py, vm.py — compile + VM execution
  • verifier.py — bytecode / signature checks
  • equiv_lock.py, equiv_test.py — interpreter vs VM comparison
  • arg_parser.py, saka.py — CLI

When changing language semantics:

  1. Update interpreter behavior.
  2. Mirror behavior in compiler/VM.
  3. Update verifier rules if builtin signatures or op behavior changed.
  4. Add/adjust tests (especially tests/equivalence/).
  5. Re-check equivalence output before shipping.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osakaprogramminglanguage-0.1.0.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osakaprogramminglanguage-0.1.0-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

Details for the file osakaprogramminglanguage-0.1.0.tar.gz.

File metadata

  • Download URL: osakaprogramminglanguage-0.1.0.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for osakaprogramminglanguage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b9743b8a8130d4e0407c3784f0551f0fd8accd0f1f4429653de5f60fe0dfc5fc
MD5 a89fff65689ac663628ce3840fa1c716
BLAKE2b-256 6e2c90cd7865240d1de224c47e5127ec2a90afdc64a164ebc61d737b6acc1b87

See more details on using hashes here.

File details

Details for the file osakaprogramminglanguage-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for osakaprogramminglanguage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cae54d9a9ecb7f08e7fa2bb820207d2a76518e2e3ed4dc238a60a35c1176592
MD5 fd5546b1d2ab72e39f171be99343913a
BLAKE2b-256 d3fb9d28abaa97eb7efebeff865f2890227855405274a7c95745b84b13139676

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page