Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaterC# Logo

💧 WaterC# Programming Language

WaterC# is a high-performance, badass, systems-ready programming language and compiler written in C#. It combines a clean, simple syntax with low-level systems capabilities (pointers, raw memory manipulation, structs, and native FFI), making it suitable for creating operating systems, other programming languages, games, and native desktop applications.


⚡ Key Highlights

  • Zero VS Code Extension Needed: You don't need to search or install any extensions from the VS Code Marketplace! WaterC# has built-in tools that make editor plugins unnecessary:
    • water studio: Built-in in-browser Web IDE with live editor, runner, examples, and standalone EXE compiler!
    • water check <file>: Visual ASCII error pointers showing exact line & column right in your terminal (no red squiggles extension needed).
    • water fmt <file>: Built-in canonical code formatter (no Prettier or formatter plugin needed).
  • Run Anywhere (Zero Dependency): Compiles directly into standalone .exe binaries with zero runtime baggage. Output executables run on any machine without needing water.exe or any compiler side-by-side.
  • Zero File Extension Requirement: Name your files however you like! main, game.wc, kernel.water, or script.txt. WaterC# compiles and runs them all seamlessly.
  • Freestanding C/OS Target (--target os): Emits pure, freestanding C99 code with hardware I/O macros for bare-metal OS kernels, bootloaders, and microcontrollers.
  • Fast Interactive Dev: Includes instant direct execution (water run <file>) and an interactive shell (water repl).
  • Low-Level Power: Direct heap allocation (alloc, free), memory peek/poke (peek, poke, peek_int, poke_int), and native Windows API calls (extern fn MessageBoxA(...)).

🚀 Quick Start

1. Build the WaterC# Compiler

The compiler builds out of the box using Windows' standard built-in C# compiler:

build.bat

(Or via PowerShell: .\build.ps1)

This produces water.exe in the root directory.

2. Run Commands

# Run a file immediately (extensionless files supported!)
water run examples/hello

# Compile to a standalone .exe (runs anywhere without compiler)
water build examples/hello -o hello.exe
.\hello.exe

# Compile for Bare-Metal OS Kernels (Freestanding C99)
water build examples/os_kernel_stub.wc --target os -o kernel.c

# Start the interactive REPL
water repl

📖 Language Syntax Guide (Simple & Beginner-Friendly)

1. Variables & Math (No Semicolons, No let/mut Required!)

name = "Aqua"
score = 100
score = score + 25

print("Player:", name, "Score:", score)

2. Making Decisions (if / else)

if score > 100 {
    print("Victory!")
} else {
    print("Keep playing!")
}

3. Clean Functions

fn add(a, b) {
    return a + b
}

result = add(10, 20)
print("Result is:", result)

4. Simple Loops

for i in 0..5 {
    print("Round:", i)
}

5. Memory & OS Systems (buf[i])

buf = alloc(16)
buf[0] = 65       // Write byte directly with brackets!
print("Byte 0:", buf[0])
free(buf)

Win32 API & Native Calls

extern fn MessageBoxA(hwnd: ptr, text: string, caption: string, utype: int): int;

fn main() {
    MessageBoxA(0, "Running natively on Windows!", "WaterC#", 64);
}

🎮 Included Examples & Showcases

File Description Run / Build Command
examples/beginner_start.wc First Time Coder: Variables, math, if/else, and loops in 15 clean lines! water run examples/beginner_start.wc
examples/simple_game.wc Beginner Game: A fun dice-rolling adventure with HP, gold, and random rolls. water run examples/simple_game.wc
examples/hello Zero-extension demonstration. Runs and compiles without any file extension. water run examples/hello
examples/fibonacci.wc Recursive functions and mathematical loops. water run examples/fibonacci.wc
examples/systems_memory.wc Heap memory, raw pointers, bitwise math, and struct manipulation. water build examples/systems_memory.wc -o sys.exe
examples/mini_lang.wc Language Building: A virtual machine and stack-based interpreter written in WaterC#! water run examples/mini_lang.wc
examples/os_kernel_stub.wc OS Development: Bare-metal VGA text buffer (0xB8000) and hardware control. water build examples/os_kernel_stub.wc --target os -o kernel.c
examples/game_water_snake.wc Game Development: Real-time console game with game loop, coordinates, and score. water build examples/game_water_snake.wc -o game.exe
examples/win32_window.wc Native Win32 GUI MessageBox via FFI. water build examples/win32_window.wc -o win32.exe

🛠️ CLI Options

Usage:
  water run <file>                    Run a WaterC# file immediately
  water build <file> [options]        Compile to standalone binary or C code
  water repl                          Start interactive WaterC# shell
  water version                       Show version information
  water help                          Show this help menu

Build Options:
  -o, --output <path>                 Specify output executable or file name
  -t, --target <exe|c|os>             Target backend (default: exe)
                                      - exe: Standalone zero-dependency executable
                                      - os:  Freestanding C99 for OS kernels/bare-metal
                                      - c:   Standard C99 output

Thoughts about this crazy project!

Well... while making it took me one day!? yeah... its a one day project u can get a hang of it

About

WaterC# programming language: simple mid-difficulty syntax, standalone native compiler, OS kernel emitter, and zero-extension browser studio.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages