Prototype interpreter and design docs for the Greyalien language.
Project description
Greyalien Language (Prototype)
This is a prototype implementation of the Greyalien language concept: a new, experimental programming language designed to surpass traditional systems languages in clarity and safety.
This ZIP includes:
SPEC.md– Greyalien v0 conceptual language design.SPEC_V0.md– the subset spec implemented by this interpreter.GREYALIEN_CORE.md– core design principles.GREYALIEN_VISION.md– long-term vision and roadmap.compiler_architecture.md– high-level architecture for a future native Greyalien compiler.LICENSE– MIT license.CONTRIBUTING.md– contribution guide.CHANGELOG.md– release notes.RELEASE.md– release checklist.ROADMAP.md– v0.2 scope and priorities.TRIAGE.md– issue triage guide.Makefile– release helper targets.greyalien/– a minimal Greyalien interpreter implemented in Python for a small v0 subset.examples/– runnable.grlprograms.
Note: The interpreter is intentionally small. It runs a Greyalien subset with functions, conditionals, loops, records, lists, match expressions, enums, imports, arithmetic, booleans, and printing. It is meant as a working playground, not a production compiler.
A minimal static type checker for
Int,Bool, andStringruns before execution and reports type errors.
What's new in v0.3.0
matchexpressions, enums, and enum payloads.- Module imports with a minimal loader.
- Conformance fixtures and parser fuzz coverage.
Unreleased (main branch)
- Scoped module namespaces (imports require qualification, e.g.
math.add(...)). - Explicit exports (
export { ... }) control module visibility. - Exported enums are type-only; variants must be listed explicitly.
- Enum payload bindings in match patterns (for example,
Some(x)). - Module-qualified enum types in annotations (for example,
colors.Color).
Requirements
- Python 3.9+
Install from PyPI
python -m pip install greyalien-prototype
Create a file hello.grl:
fn main() {
print("Hello from Greyalien!");
}
Run it:
greyalien run hello.grl
Install from source
python -m pip install -e .
Then run:
greyalien run examples/hello.grl
Running examples
From the directory where you unpack the ZIP:
python -m greyalien.cli examples/hello.grl
Or with the unified CLI:
python -m greyalien run examples/hello.grl
You should see:
Hello from Greyalien!
Another example:
python -m greyalien.cli examples/math.grl
Or:
python -m greyalien run examples/math.grl
Expected output:
Result is 42
Module example with qualified enum types:
python -m greyalien run examples/modules/type_qual_demo.grl
Expected output:
red
Logic example:
python -m greyalien.cli examples/logic.grl
For-loop example:
python -m greyalien.cli examples/for_demo.grl
Typed example:
python -m greyalien.cli examples/typed.grl
Record example:
python -m greyalien.cli examples/records.grl
List example:
python -m greyalien.cli examples/list_demo.grl
Match example:
python -m greyalien.cli examples/match_demo.grl
Enum example:
python -m greyalien.cli examples/enum_demo.grl
Enum payload example:
python -m greyalien.cli examples/enum_payload_demo.grl
Module/import example:
python -m greyalien.cli examples/modules/module_demo.grl
Running tests
python -m unittest discover -s tests
Maintainer notes
- Issue triage flow and labels:
TRIAGE.md - Label definitions live in
.github/labels.ymland sync via theLabel Syncworkflow
Type checking only
python -m greyalien check examples/typed.grl
CLI quick reference
greyalien <file.grl>
greyalien run <file.grl>
greyalien check <file.grl>
greyalien ir <file.grl>
greyalien --all-errors <file.grl>
greyalien run --all-errors <file.grl>
greyalien check --all-errors <file.grl>
greyalien --version
greyalien --help
CLI help example
greyalien --help
Usage:
greyalien <file.grl>
greyalien run <file.grl>
greyalien check <file.grl>
greyalien ir <file.grl>
greyalien --all-errors <file.grl>
greyalien run --all-errors <file.grl>
greyalien check --all-errors <file.grl>
greyalien --version
greyalien --help
Options:
--all-errors Show all parse errors instead of the first.
Parse error diagnostics
Use --all-errors to report every parse error in one run:
greyalien check --all-errors examples/for_demo.grl
Subset supported by the interpreter
-
Optional
moduledeclaration (ignored at runtime):module main
-
Function definitions:
fn main() { print("Hello"); } fn add(a, b) { return a + b; } -
Optional type annotations (checked before execution):
fn add(a: Int, b: Int) -> Int { return a + b; } fn main() { let x: Int = 1; print("x = " + x); }Type errors include line/column locations where available.
-
letbindings inside functions:fn demo() { let x = 10; let y = x * 2; print(y); } -
setassignments to update existing bindings:fn demo() { let count = 0; set count = count + 1; } -
whileloops:fn demo() { let i = 0; while i < 3 { print(i); set i = i + 1; } } -
forloops over integer ranges:fn demo() { for i in 0..10 by 2 { print(i); } }Use
start..endfor exclusive ranges orstart..=endfor inclusive ranges. Addby stepto control the step size. -
breakandcontinueinside loops:fn demo() { for i in 0..10 { if i == 2 { continue; } else { print(i); }; if i == 5 { break; } else { 0; }; } }fn demo() { let i = 0; while true { set i = i + 1; if i == 2 { continue; } else { 0; }; if i == 4 { break; } else { 0; }; } } -
returnstatements in functions. -
Expressions:
- Integer literals:
1,42 - String literals:
"hello" - Boolean literals:
true,false - Record literals:
{x: 1, y: 2} - List literals:
[1, 2, 3] - Unary operators:
-expr,!expr - Binary operators:
+,-,*,/,==,!=,<,<=,>,>=,&&,|| - Field access:
expr.field - Indexing:
expr[index] - Parentheses:
(expr) ifexpressions:if cond { expr; } else { expr; }else ifis supported as sugar forelse { if ... }
- Integer literals:
-
Function calls:
name(arg1, arg2) -
Built-in
print(...)for output.
Types supported by the checker: Int, Bool, String, Unit.
Anything else will result in a parse or runtime error.
Example Greyalien program
module main
fn main() {
let a = 40;
let b = 2;
let result = a + b;
print("Result is " + result);
}
This runs on the interpreter and prints:
Result is 42
Enjoy experimenting with Greyalien!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file greyalien_prototype-0.3.0.tar.gz.
File metadata
- Download URL: greyalien_prototype-0.3.0.tar.gz
- Upload date:
- Size: 50.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0589cf7eaa9c70bd77edce5453234d4cd15e160151899be0ac1e74addb2afb17
|
|
| MD5 |
6d680b572095aeaf9e998659704d4c86
|
|
| BLAKE2b-256 |
ba183b65b216ba63e8604786b2cbeea03e7782af38266938c9d8f404c899ca70
|
Provenance
The following attestation bundles were made for greyalien_prototype-0.3.0.tar.gz:
Publisher:
publish.yml on JROChub/greyalien-prototype
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
greyalien_prototype-0.3.0.tar.gz -
Subject digest:
0589cf7eaa9c70bd77edce5453234d4cd15e160151899be0ac1e74addb2afb17 - Sigstore transparency entry: 844624209
- Sigstore integration time:
-
Permalink:
JROChub/greyalien-prototype@613c56453f0d8642a65b00e2d93e37097102d76e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/JROChub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@613c56453f0d8642a65b00e2d93e37097102d76e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file greyalien_prototype-0.3.0-py3-none-any.whl.
File metadata
- Download URL: greyalien_prototype-0.3.0-py3-none-any.whl
- Upload date:
- Size: 32.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
526c0627972c01bec8f4b33505657d64f9fd24f59a69dc827c79b50780ebb04c
|
|
| MD5 |
0b122bc53d30bae4faec98ae5bb6635c
|
|
| BLAKE2b-256 |
20223c4749caa6d54963882296460954be7e1a535f4ff49bcf2c50d1c91bac15
|
Provenance
The following attestation bundles were made for greyalien_prototype-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on JROChub/greyalien-prototype
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
greyalien_prototype-0.3.0-py3-none-any.whl -
Subject digest:
526c0627972c01bec8f4b33505657d64f9fd24f59a69dc827c79b50780ebb04c - Sigstore transparency entry: 844624216
- Sigstore integration time:
-
Permalink:
JROChub/greyalien-prototype@613c56453f0d8642a65b00e2d93e37097102d76e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/JROChub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@613c56453f0d8642a65b00e2d93e37097102d76e -
Trigger Event:
workflow_dispatch
-
Statement type: