softpy

Python-inspired language that compiles to JavaScript

TypeScriptNode.jsnpm
let name = "world"
let x = 10

func greet(who)
  print("hello, " + who)
end

if x > 5
  greet(name)
end

that's softpy. python-like syntax that compiles to javascript and runs in-browser or via CLI.

the pipeline

.spy source → lexer (tokenizes into numbers, strings, keywords, operators) → parser (builds an AST from the token stream) → code generator (walks the AST and emits javascript). the output is standard JS that runs anywhere.

what the language supports

variables, strings, numbers, booleans, arithmetic, comparisons, if/else, loops, user-defined functions with arguments, and print. enough to write real programs, small enough to understand the whole compiler.

try it

there's an online playground at softpy-web.vercel.app where you can write and run softpy in the browser. or install the compiler from npm (@softpy/compiler) and run .spy files locally.

← back home