A programming language designed for clarity. No noise, just logic.
sauravcode is a programming language that strips away the ceremony of traditional syntax. No parentheses for function calls. No commas between arguments. No semicolons. No braces. Just clean, readable code that flows like thought.
It comes with both an interpreter for rapid prototyping and a compiler that produces native executables via C code generation.
π Documentation Site Β· π Language Reference Β· ποΈ Architecture Guide
- Minimal syntax β no parentheses, commas, semicolons, or braces
- Dual execution β interpreted (
saurav.py) or compiled to native (sauravcc.py) - Interactive REPL β experiment with sauravcode in real-time
- Functions & recursion β with clean call syntax
- Lambda expressions β
lambda x -> x * 2for inline functions - Pipe operator β
"hello" |> upper |> reversefor chaining - Dynamic typing β integers, floats, booleans, strings, lists, maps
- Control flow β if/else if/else, while, range-based for, for-each, break/continue
- Pattern matching β
matchexpressions with wildcard and literal patterns - Generators β functions with
yieldfor lazy sequences - Enums β named constant groups with dot access
- Classes β with fields, methods, and
self - Error handling β try/catch/throw blocks
- Import system β
import "module.srv"with closure scoping - Lists β dynamic arrays with append, pop, len, indexing, slicing, comprehensions
- Maps β key-value dictionaries with
{}syntax, bracket access, and built-in functions - 105 built-in functions β strings, math, stats, regex, date/time, JSON, encoding, hashing, HTTP, I/O, bitwise
- String interpolation β
f"Hello {name}, you are {age} years old"f-strings - Logical operators β
and,or,not - Compiler generates readable C β inspect with
--emit-c - Developer tooling β formatter, linter, profiler, debugger, coverage, benchmarks, AST visualizer, playground, dependency graph, complexity analyzer, notebook runner, watch mode, snapshot testing
- VS Code extension β syntax highlighting, 25 snippets, and language configuration
pip install sauravcodeAfter installation, two commands are available globally:
sauravcodeβ interpreter + interactive REPLsauravcode-compileβ compiler (.srv β C β native executable)
- Python 3.8+
- gcc (for compiler β MinGW on Windows, Xcode CLI on macOS)
Start the REPL with no arguments for instant experimentation:
python saurav.pysauravcode REPL v1.0
Type "help" for commands, "quit" to exit.
>>> x = 10
>>> print x + 5
15
>>> function double n
... return n * 2
...
>>> print double x
20
>>> vars
x = 10
>>> quit
Bye!
REPL commands: help, vars, funcs, clear, history, load FILE, quit
python saurav.py hello.srvpython sauravcc.py hello.srv # Compile and run
./hello # Run the binary directlyprint "Hello, World!"
No parentheses, no commas β just the function name and its arguments:
function greet name
print "Hello,"
print name
greet "world"
x = 10
y = 3
print x + y # 13
print x * y # 30
print x % y # 1
score = 85
if score >= 90
print "A"
else if score >= 80
print "B"
else
print "below B"
# While
i = 0
while i < 5
print i
i = i + 1
# For (range-based)
for i 1 6
print i # prints 1 through 5
# Break and Continue
for i 0 10
if i == 5
break # exit loop early
if i % 2 == 0
continue # skip even numbers
print i # prints 1, 3
Use parentheses only when you need to disambiguate nested expressions:
function factorial n
if n <= 1
return 1
return n * factorial (n - 1)
print factorial 10 # 3628800
nums = [10, 20, 30]
print nums[0] # 10
print len nums # 3
append nums 40
print nums[3] # 40
# Create a map with { key: value } syntax
person = {"name": "Alice", "age": 30, "active": true}
print person["name"] # Alice
# Add/update keys
person["email"] = "alice@example.com"
person["age"] = 31
# Built-in map functions
k = keys person # list of keys
v = values person # list of values
print has_key (person) "name" # true
print contains (person) "email" # true
print len person # 4
print type_of person # map
# Word frequency counter
words = split "hello world hello" " "
freq = {}
for i 0 len words
word = words[i]
if contains (freq) word
freq[word] = freq[word] + 1
else
freq[word] = 1
print freq["hello"] # 2
Embed expressions directly in strings with the f"..." syntax:
name = "Alice"
age = 30
print f"Hello, {name}!" # Hello, Alice!
print f"{name} is {age} years old" # Alice is 30 years old
print f"2 + 3 = {2 + 3}" # 2 + 3 = 5
# Works with any expression
items = [1, 2, 3]
print f"count: {len items}" # count: 3
print f"upper: {upper name}" # upper: ALICE
# Escaped braces: {{ and }} produce literal { and }
x = 42
print f"value: {{x}} = {x}" # value: {x} = 42
class Point
function init x y
self.x = x
self.y = y
try
x = risky_operation
catch err
print "something went wrong"
Sauravcode includes 95 built-in functions β no imports needed. See the full Standard Library Reference.
# String functions
print upper "hello" # HELLO
print lower "HELLO" # hello
print trim " spaces " # spaces
print replace "hi world" "world" "sauravcode"
words = split "a-b-c" "-" # ["a", "b", "c"]
print join ", " words # a, b, c
print contains "hello" "ell" # true
print starts_with "hello" "he" # true
print substring "hello" 0 3 # hel
print char_at "hello" 0 # h
# Math functions
print sqrt 16 # 4
print power 2 10 # 1024
print round 3.14159 2 # 3.14
print floor 3.7 # 3
print ceil 3.2 # 4
print abs (-42) # 42
# Statistics
print mean [1, 2, 3, 4, 5] # 3.0
print median [1, 3, 5, 7] # 4.0
print stdev [2, 4, 4, 4, 5] # 0.894...
# Regex
print regex_match "^\d+$" "42" # true
print regex_replace "\s+" "-" "a b c" # a-b-c
# Date/Time
print now # 2026-03-07T15:...
d = date_add (now) 7 "days" # one week from now
# JSON
data = json_parse "{\"x\": 1}" # {"x": 1}
print json_pretty data # formatted
# Hashing & Encoding
print sha256 "hello" # 2cf24dba...
print base64_encode "hello" # aGVsbG8=
# Map functions
m = {"a": 1, "b": 2}
k = keys m # ["a", "b"]
v = values m # [1, 2]
print has_key (m) "a" # true
print contains (m) "c" # false
Type builtins in the REPL to see all available functions with usage.
The compiler (sauravcc.py) translates sauravcode to C, then uses gcc to produce native executables.
# Compile and run
python sauravcc.py program.srv
# Emit C code only (inspect the generated code)
python sauravcc.py program.srv --emit-c
# Compile to a specific output name
python sauravcc.py program.srv -o myprogram
# Keep the intermediate .c file
python sauravcc.py program.srv --keep-c
# Verbose output
python sauravcc.py program.srv -vββββββββββββ βββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββ
β .srv βββββΆβ Tokenize βββββΆβ Parse βββββΆβ Generate βββββΆβ gcc β
β source β β (lexer) β β (AST) β β (C code)β β (native) β
ββββββββββββ βββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββ
| Feature | Interpreter | Compiler |
|---|---|---|
| Interactive REPL | β | β |
| Functions & recursion | β | β |
| Variables & assignment | β | β |
| Arithmetic (+, -, *, /, %) | β | β |
| Comparisons (==, !=, <, >, <=, >=) | β | β |
| Booleans & logical ops | β | β |
| If / else if / else | β | β |
| While loops | β | β |
| For loops (range-based) | β | β |
| Break & continue | β | β |
| Strings | β | β |
| Lists (dynamic arrays) | β | β |
| Maps (dictionaries) | β | β |
| String interpolation (f-strings) | β | β |
| Lambda expressions | β | β |
| Pipe operator | β | β |
| Pattern matching | β | β |
| Generators (yield) | β | β |
| Enums | β | β |
| Import system | β | β |
| Classes | β | β |
| Try / catch | β | β |
| Parenthesized expressions | β | β |
| Negative numbers | β | β |
Explore how sauravcode parses your programs with the AST visualizer (sauravast.py):
# Pretty tree view
python sauravast.py hello.srv
# Limit depth for large programs
python sauravast.py program.srv --depth 3
# Machine-readable JSON
python sauravast.py program.srv --json
# Node statistics
python sauravast.py program.srv --stats
# Graphviz DOT graph (pipe to dot -Tpng for images)
python sauravast.py program.srv --dot | dot -Tpng -o ast.pngExample output:
Program
βββ AssignmentNode
β βββ expression: NumberNode
β β βββ value: 42.0
β βββ name: 'x'
βββ FunctionNode
β βββ body: [2 items]
β β βββ [0]: PrintNode ...
β β βββ [1]: ReturnNode ...
β βββ name: 'greet'
β βββ params: ['name']
βββ FunctionCallNode
βββ arguments: [1 items]
β βββ [0]: StringNode
β βββ value: 'World'
βββ name: 'greet'
Inline anonymous functions for quick transformations:
double = lambda x -> x * 2
print double 5 # 10
# With higher-order functions
nums = [1, 2, 3, 4, 5]
doubled = map (lambda x -> x * 2) nums
print doubled # [2, 4, 6, 8, 10]
filtered = filter (lambda x -> x > 3) nums
print filtered # [4, 5]
Chain transformations left-to-right for readable data pipelines:
result = "hello world" |> upper |> reverse
print result # DLROW OLLEH
# Multi-step pipelines
" Hello, World! " |> trim |> lower |> print
# hello, world!
Declarative branching with match expressions:
function describe x
match x
1 -> print "one"
2 -> print "two"
3 -> print "three"
_ -> print "something else"
describe 2 # two
describe 99 # something else
Lazy sequences with yield for memory-efficient iteration:
function countdown n
while n > 0
yield n
n = n - 1
gen = countdown 5
print next gen # 5
print next gen # 4
print next gen # 3
Named constant groups with dot-notation access:
enum Color
RED
GREEN
BLUE
c = Color.RED
print c # Color.RED
match c
Color.RED -> print "red!"
Color.GREEN -> print "green!"
_ -> print "other"
Modular code with file-based imports:
# math_utils.srv
function square x
return x * x
function cube x
return x * x * x
# main.srv
import "math_utils.srv"
print square 5 # 25
print cube 3 # 27
Sauravcode ships with a comprehensive suite of developer tools:
| Tool | Command | Description |
|---|---|---|
| Formatter | python sauravfmt.py file.srv |
Auto-format code with consistent indentation and spacing |
| Linter | python sauravlint.py file.srv |
Static analysis for style, complexity, and potential bugs |
| Profiler | python sauravprof.py file.srv |
Execution profiling with call counts and timing |
| Debugger | python sauravdb.py file.srv |
Interactive debugger with breakpoints and step-through |
| Coverage | python sauravcov.py file.srv |
Code coverage analysis (line-level hit/miss) |
| Benchmarks | python sauravbench.py |
Performance benchmarks (fibonacci, sort, recursion, etc.) |
| AST Viewer | python sauravast.py file.srv |
Parse tree visualization (text, JSON, Graphviz DOT) |
| Playground | python sauravplay.py |
Interactive sandbox for experimenting |
| Semantic Diff | python sauravdiff.py a.srv b.srv |
Structural diff between sauravcode files |
| Doc Generator | python sauravdoc.py file.srv |
Extract documentation from source files |
| Dependency Graph | python sauravdeps.py file.srv |
Visualize import dependencies between modules |
| Complexity | python sauravcomplex.py file.srv |
Cyclomatic complexity analysis per function |
| Notebook | python sauravnb.py file.srvnb |
Jupyter-style notebook for literate sauravcode |
| Watch Mode | python sauravwatch.py file.srv |
Auto-rerun on file changes (live reload) |
| Snapshot Test | python sauravsnap.py file.srv |
Snapshot testing for output verification |
| Enhanced REPL | python sauravrepl.py |
REPL with history, multi-line editing, and syntax hints |
| Canvas | python sauravcanvas.py file.srv |
Turtle graphics β generate SVG/HTML from drawing commands |
The codebase has two execution paths sharing a common tokenizer design:
saurav.pyβ Tree-walk interpreter. Tokenizes, parses to AST, evaluates directly.sauravcc.pyβ Compiler. Tokenizes, parses to AST, generates C source, invokes gcc.
The compiler generates clean, readable C. Lists become dynamic arrays (SrvList) with bounds checking. Try/catch maps to setjmp/longjmp. Classes compile to C structs with associated functions.
For the full deep-dive, see the Architecture Guide.
sauravcode/
βββ saurav.py # Interpreter + interactive REPL
βββ sauravcc.py # Compiler (.srv β C β native)
βββ sauravast.py # AST visualizer (tree, JSON, DOT, stats)
βββ sauravbench.py # Benchmark runner (fib, sort, recursion, etc.)
βββ sauravcov.py # Code coverage analysis
βββ sauravdb.py # Interactive debugger
βββ sauravdiff.py # Semantic diff between .srv files
βββ sauravdoc.py # Documentation generator
βββ sauravfmt.py # Code formatter
βββ sauravlint.py # Linter (style, complexity, bugs)
βββ sauravplay.py # Interactive playground
βββ sauravprof.py # Execution profiler
βββ sauravcomplex.py # Cyclomatic complexity analyzer
βββ sauravdeps.py # Import dependency graph
βββ sauravnb.py # Jupyter-style notebook runner
βββ sauravrepl.py # Enhanced REPL with history
βββ sauravsnap.py # Snapshot testing
βββ sauravwatch.py # File watcher (live reload)
βββ sauravcanvas.py # Turtle graphics (SVG/HTML output)
βββ tests/ # 2,300+ pytest tests (40 test modules)
βββ editors/
β βββ vscode/ # VS Code extension (syntax, snippets)
βββ docs/
β βββ LANGUAGE.md # Language reference & EBNF grammar
β βββ ARCHITECTURE.md # Compiler/interpreter internals
β βββ EXAMPLES.md # Annotated examples
βββ site/
β βββ index.html # Documentation website
βββ .github/
β βββ workflows/ # CI/CD (CodeQL, Pages)
βββ STDLIB.md # Standard library reference (95 functions)
βββ CHANGELOG.md # Version history
βββ CONTRIBUTING.md # Contribution guidelines
βββ LICENSE # MIT License
Run the comprehensive test suite:
# Full test suite (interpreter + compiler + REPL)
python -m pytest tests/ -v
# Run .srv test files directly
python saurav.py test_all.srv
# Compiler
python sauravcc.py test_all.srvSee how sauravcode compares to other languages for common tasks:
| Task | sauravcode | Python | JavaScript |
|---|---|---|---|
print "hello" |
print("hello") |
console.log("hello") |
|
| Function | function add a b return a + b |
def add(a, b): return a + b |
function add(a, b) { return a + b; } |
| Call | add 3 5 |
add(3, 5) |
add(3, 5) |
| For loop | for i 1 6 print i |
for i in range(1, 6): print(i) |
for (let i=1; i<6; i++) console.log(i) |
| Lambda | lambda x -> x * 2 |
lambda x: x * 2 |
x => x * 2 |
| Pipe | "hi" |> upper |> reverse |
N/A (nested calls) | N/A (method chaining) |
| F-string | f"Hi {name}" |
f"Hi {name}" |
`Hi ${name}` |
| List comp | [x * 2 for x in range 1 6] |
[x*2 for x in range(1,6)] |
[...Array(5)].map((_,i)=>(i+1)*2) |
Key differences: No parentheses for calls, no commas between arguments, no semicolons, no braces. Indentation defines blocks (like Python), but function calls are cleaner.
Code should read like thought. No ceremony, no noise β just logic.
Traditional languages carry decades of syntactic baggage. Sauravcode asks: what if we kept only what matters?
- Function calls without parentheses β
add 3 5instead ofadd(3, 5) - Indentation-based blocks β no
{}orendkeywords - Minimal punctuation β colons, semicolons, and most commas are gone
- Disambiguation when needed β parentheses are available for complex expressions
The result is code that reads almost like pseudocode but actually runs.
| Document | Description |
|---|---|
| Standard Library | All 95 built-in functions with signatures and examples |
| Language Reference | Complete spec with EBNF grammar, types, operators, precedence |
| Architecture Guide | How the tokenizer, parser, interpreter, and compiler work |
| Examples | Annotated programs covering all features |
| Changelog | Version history and notable changes |
| Website | Interactive documentation |
| Home Page | Project home |
Full syntax highlighting, 25 code snippets, and language configuration for VS Code.
Quick install:
# Symlink the extension (Windows)
mklink /D "%USERPROFILE%\.vscode\extensions\sauravcode" "path\to\sauravcode\editors\vscode"
# Symlink the extension (macOS / Linux)
ln -s path/to/sauravcode/editors/vscode ~/.vscode/extensions/sauravcodeSee editors/vscode/README.md for full details.
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes with tests
- Test with both interpreter and compiler
- Submit a pull request
- Additional data structures (sets, tuples)
- Compiler support for maps, f-strings, generators, and pattern matching
- Editor support for more editors (Sublime Text, Vim, Emacs, JetBrains)
- Optimization passes in the compiler
- Async/concurrent execution
- Package manager for .srv modules
This project is licensed under the MIT License.
Saurav Bhattacharya β GitHub