Skip to content

Xrenes/Byte-to-Byte

Repository files navigation

Byte to Byte — Source-to-Source Transpiler

A compiler-design project that transpiles code between 10 programming languages using a full parse → analyze → optimize → emit pipeline.


Live Demos

Interface Link
Web App (full editor UI) xrenes.github.io/Byte-to-Byte
Terminal Preview (interactive TUI in browser) xrenes.github.io/Byte-to-Byte/terminal.html

Supported Languages

Python · JavaScript · TypeScript · Java · C · C++ · C# · Go · Rust · Ruby

90+ source → target pairs


How It Works

Source Code  →  parse()  →  analyze()  →  optimize()  →  emit()  →  Output
  1. Parser — tokenizes source into typed AST nodes
  2. Analyzer — builds symbol table, resolves scopes, infers types
  3. Optimizer — constant folding, dead code elimination
  4. Emitter — generates idiomatic target-language code

Project Structure

File Purpose
parser.js Core compiler engine (~1800 lines, zero dependencies)
index.html Landing page with particle animation
app.html Main two-panel web editor UI
terminal.html Browser-based interactive terminal emulator
transpiler.js Web UI wiring (12-pass regex pipeline)
b2b.js CLI tool (--from, --to, --out flags)
b2b-app.js Node.js ANSI terminal TUI
style.css Dark green theme, CSS variables
test_semantic.js 36 automated semantic analysis tests

Run Locally

# Web UI — open in browser directly (no server needed)
start index.html

# CLI tool
node b2b.js --from python --to java input.py

# Interactive terminal TUI
node b2b-app.js

Compiler Design project — built with pure JavaScript, zero runtime dependencies.

About

A compiler design lab project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors