Skip to content

QuantumLogicsLabs/QuantumLanguage-Website

Repository files navigation

Quantum Language - A Multi-Paradigm Scripting Language

Language Version Extension License Platform


What is Quantum?

Quantum is a dynamically typed, multi-paradigm scripting language that compiles .sa source files to bytecode and runs them on a custom register-stack VM. It accepts Python-style, JavaScript-style, and C/C++-style syntax all in the same file.

Built from scratch in C++17 by one person in 3 weeks. It works. Remarkably well, actually.


The Big Idea

Why choose one syntax when you can have all three? Quantum lets you write code the way you think:

# Python-style function
def greet(name):
    return "Hello, " + name

# JavaScript-style function  
function add(a, b) {
    return a + b
}

# C++-style function
fn multiply(x, y) {
    return x * y
}

# All valid. All work together.
print(greet("World"))
print(add(5, 3))
print(multiply(4, 7))

Architecture

Two Execution Paths

quantum.exe - Compile + Bundle:

.sa source
   |
   v
Lexer  ->  Token stream
   |
   v  
Parser  ->  AST
   |
   v
Compiler ->  Bytecode
   |
   v
Bundle ->  hello.exe (standalone)

qrun.exe - Direct Interpretation:

.sa source -> Lexer -> Parser -> VM::run()

The VM

  • Stack-based bytecode interpreter
  • 34 AST node types
  • 11 value types in std::variant
  • Closures and upvalues for first-class functions
  • Exception handling with try/catch
  • Real pointers in a scripting language (yes, really)

Language Features

Multi-Syntax Support

# Variables - all valid
name = "Alice"           # bare assignment
let x = 42               # quantum-style  
const MAX = 100          # constant
int count = 0            # C++ type hint (decorative)

# Control flow - pick your style
if x > 0:
    print("positive")    # Python-style

if x > 0 { print("positive") }  # brace-style

if(x > 0) { printf("%d\n", x) }  # C++-style

Functions - Five Styles

fn add(a, b) { return a + b }           # quantum
def greet(name): return "Hi, " + name  # python
function mul(a, b) { return a * b }    # javascript
double = (x) => x * 2                  # arrow
square = fn(n) { return n * n }        # anonymous

Classes & OOP

class Animal {
    fn init(name, sound) {
        self.name = name
        self.sound = sound
    }
    fn speak() { 
        return self.name + " says " + self.sound 
    }
}

class Dog extends Animal {
    fn fetch(item) { 
        return self.name + " fetches " + item 
    }
}

let dog = Dog("Rex", "Woof")
print(dog.speak())
print(dog.fetch("ball"))

Pointers (Yes, Really)

let x = 42
let ptr = &x        # address-of
*ptr = 99           # dereference + assign
print(x)            # 99

# Class pointer
class Point { fn init(x, y) { self.x = x; self.y = y } }
p = Point(3, 4)
pp = &p
print(pp->x)        # arrow operator

Collections & Comprehensions

# Arrays with slicing
arr = [1, 2, 3, 4, 5]
print(arr[1:3])     # [2, 3]
print(arr[::-1])    # reversed

# List comprehension
squares = [x * x for x in range(1, 6)]
evens = [x for x in range(10) if x % 2 == 0]

# Dictionaries
person = {
    "name": "Saad",
    "age": 18,
    "gpa": "[403 Forbidden]"
}

Exception Handling

try {
    if x == 0 { throw "division by zero" }
    print(100 / x)
} catch (e) {
    print("Caught:", e)
}

Standard Library

Quantum ships with 200+ native functions:

Core

len()  type()  range()  print()  input()  assert()
list()  enumerate()  zip()  map()  filter()  sorted()

Math

abs  sqrt  floor  ceil  round  pow  log  sin  cos  tan
PI  E  INF  is_prime  gcd  lcm

Crypto & Security

sha256()  md5()  aes128_ecb_encrypt()  rot13()
xor_bytes()  base64_encode()  hmac_sha256()
secure_random_hex()  entropy()

File I/O

read_file()  write_file()

String Methods

.upper()  .lower()  .split()  .replace()  .contains()
.startswith()  .endswith()  .index_of()  .slice()

Quick Start

Prerequisites

  • Windows (primary platform)
  • C++17 compatible compiler (MSVC 2019+, GCC 9+, Clang 10+)
  • CMake 3.16+

Build

# Full clean build
build.bat

# Incremental build (faster)
build-fast.bat

Usage

# Compile to standalone exe, then run
quantum hello.sa

# Interpret directly (no exe created)
qrun hello.sa

# Run the produced exe
hello.exe

# Interactive REPL
qrun

# Debug mode (show bytecode)
quantum --debug hello.sa

# Disassemble only
quantum --dis hello.sa

Project Structure

Quantum-Language/
{
  "src/": "Source code - lexer, parser, compiler, VM",
  "include/": "Headers - AST, Value, Opcode, etc",
  "examples/": "Sample .sa programs",
  "tests/": "Test programs",
  "Website/": {
    "index.html": "Landing page",
    "ide.html": "Browser IDE with live interpreter",
    "language.html": "Complete documentation",
    "logo/": "Assets"
  },
  "quantum.exe": "Compiler + bundler",
  "qrun.exe": "Direct interpreter", 
  "quantum_stub.exe": "Runtime template"
}

The Website

The project includes a complete website with:

Landing Page (index.html)

  • Hero section with animated effects
  • Feature showcase
  • Interactive demos
  • Matrix rain and particle effects

Interactive IDE (ide.html)

  • Full Quantum interpreter in browser
  • Syntax highlighting for 34+ AST nodes
  • Multi-file editor with .sa support
  • Real-time output console
  • Example library with categorized samples
  • Custom cursor and terminal UI

Documentation (language.html)

  • Complete language reference
  • Standard library docs
  • Interactive examples
  • Mobile-responsive design

Why Quantum?

  1. Syntax Freedom - Write Python, JavaScript, or C++ style - or mix them
  2. Real Pointers - C-style pointers in a scripting language
  3. Bytecode VM - Compiles to efficient bytecode, runs on custom VM
  4. Standalone Exes - Bundle bytecode into single executable
  5. Rich Stdlib - 200+ functions including crypto, math, I/O
  6. Three Weeks - Built entirely by one person in 21 days

The .sa Extension

Why .sa? We don't know either. Some things are meant to remain mysterious.


Performance

  • Compilation: ~1000 lines/second
  • Execution: 50K+ bytecode instructions/second
  • Memory: ~2MB base footprint
  • Startup: <100ms for most programs

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with quantum --test examples/
  5. Submit a pull request

License

MIT License - see LICENSE file.


Built in C++17 · Bytecode VM Edition · .sa Files Only

GitHub Stars

"It works. Remarkably well, actually."

About

Quantum Language — Where Multiple Paradigms Collide to Empower the Next-Gen Hacker Mind

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors