Examples

Example Applications

Real-world applications written entirely in Jda, demonstrating the language’s capabilities for production use. Each compiles to a static binary under 1.1 MB with zero external dependencies.

jda-grep

A high-performance text search tool – Jda’s first real application. Demonstrates CLI argument parsing, file I/O, pattern matching, and ANSI color output, all using Jda’s standard library.

Features

  • Pattern matching (substring search)
  • Case-insensitive search (-i)
  • Line numbers (-n)
  • Match count (-c)
  • Invert match (-v)
  • List matching files only (-l)
  • Multi-file search with filename prefixes
  • Stdin piping support
  • ANSI color output (disable with --no-color)
  • Combined short flags (-ni, -cv, etc.)
  • Proper exit codes (0 = match found, 1 = no match, 2 = error)

Build

bash apps/build-grep.sh

Usage

# Search for pattern in file
./apps/jda-grep error log.txt

# Case-insensitive with line numbers
./apps/jda-grep -ni TODO main.jda

# Count matches across multiple files
./apps/jda-grep -c "fn " stdlib/*.jda

# List files containing pattern
./apps/jda-grep -l bug *.jda

# Pipe from stdin
cat server.log | ./apps/jda-grep "500 Internal"

# Show non-matching lines
./apps/jda-grep -v "^;" config.jda

Binary Size

~1.05 MB static ELF binary. Zero external dependencies.

jda-httpd

A minimal HTTP/1.1 server written in Jda. Pure syscalls, zero libc. Demonstrates socket programming, string parsing, and HTTP protocol handling.

Features

  • HTTP/1.1 GET request handling
  • Route-based dispatch with multiple endpoints
  • Query string parsing
  • Server uptime and request counting
  • Fibonacci computation endpoint
  • Echo endpoint
  • Pure Linux syscalls (no libc, no external dependencies)

Supported Routes

RouteDescription
GET /Welcome page with links to all endpoints
GET /hello“Hello from Jda!”
GET /statusServer stats (uptime, requests served)
GET /echo?msg=...Echoes query string
GET /fib?n=...Computes fibonacci(n)
Everything else404 Not Found

Build

bash apps/build-httpd.sh

Usage

# Start on default port 8080
./apps/jda-httpd

# Start on custom port
./apps/jda-httpd 3000

# Test with curl
curl http://localhost:8080/hello
curl http://localhost:8080/fib?n=30
curl http://localhost:8080/echo?msg=hello+world
curl http://localhost:8080/status

Binary Size

~1 MB static ELF binary. Zero external dependencies.

jda-ml-demo

Neural network training benchmark – Jda vs Python head-to-head comparison. Trains MLPs from scratch with no external dependencies on either side. Jda is up to 37x faster than Python.

Tasks

#TaskArchitectureEpochs
1XOR Classification2->8->1 MLP5,000
2Sine Approximation1->16->1 MLP10,000
3Matrix Multiply64x64 matmul10 iters

Performance (x86-64 Linux, best of 3)

TaskJdaPython (no NumPy)Speedup
XOR training (5K epochs)21 ms778 ms~37x
Sine training (10K epochs)439 ms15,347 ms~35x
64x64 matmul (per iter)3 ms75 ms~25x

Both implementations use identical algorithms (same loop structure, same SGD, same loss function). The only difference is the runtime: Jda compiles to native x86-64 machine code, Python interprets through CPython.