============================================================ Biru Web Server — Contoh Source Code per Runtime https://biru.dot.my.id ============================================================ Setiap folder berisi satu file index yang auto-detect oleh Biru. Akses URL: https://biru.dot.my.id/nama-runtime/ Biru compile + render otomatis, hasilnya langsung muncul di browser. ------------------------------------------------------------ 1. BASH — bash/index.sh ------------------------------------------------------------ #!/bin/bash VER=$(bash --version 2>&1 | sed -n "s/^GNU bash, version \([0-9.]*\).*/\1/p" | head -1) echo "Content-Type: text/html; charset=UTF-8" echo "" echo "

Hello World

" echo "

Bash $VER

" ------------------------------------------------------------ 2. PERL — perl/index.pl ------------------------------------------------------------ #!/usr/bin/perl print "Content-Type: text/html; charset=UTF-8\n\n"; print "

Hello World

\n"; print "

Perl " . $^V . "

\n"; ------------------------------------------------------------ 3. PYTHON — python/index.py ------------------------------------------------------------ #!/usr/bin/python3 import sys print("Content-Type: text/html; charset=UTF-8") print() print("

Hello World

") print(f"

Python {sys.version.split()[0]}

") ------------------------------------------------------------ 4. RUBY — ruby/index.rb ------------------------------------------------------------ #!/usr/bin/ruby puts "Content-Type: text/html; charset=UTF-8" puts "" puts "

Hello World

" puts "

Ruby #{RUBY_VERSION}

" ------------------------------------------------------------ 5. GO — go/index.go ------------------------------------------------------------ package main import ( "fmt" "runtime" ) func main() { fmt.Println("Content-Type: text/html; charset=UTF-8") fmt.Println() fmt.Println("

Hello World

") fmt.Printf("

Go %s

\n", runtime.Version()) } ------------------------------------------------------------ 6. C — c/index.c ------------------------------------------------------------ #include #include int main(void) { printf("Content-Type: text/html; charset=UTF-8\n\n"); printf("

Hello World

\n"); FILE *p = popen("gcc --version | head -1", "r"); if (p) { char buf[128]; if (fgets(buf, sizeof(buf), p)) { printf("

%s

\n", buf); } pclose(p); } return 0; } ------------------------------------------------------------ 7. NASM — nasm/index.asm ------------------------------------------------------------ section .data ct db "Content-Type: text/html; charset=UTF-8",10,10 ct_len equ $ - ct h1 db "

Hello World

",10 h1_len equ $ - h1 h3 db "

NASM 2.15.03

",10 h3_len equ $ - h3 section .text global _start _start: mov eax, 4 mov ebx, 1 mov ecx, ct mov edx, ct_len int 0x80 mov eax, 4 mov ebx, 1 mov ecx, h1 mov edx, h1_len int 0x80 mov eax, 4 mov ebx, 1 mov ecx, h3 mov edx, h3_len int 0x80 mov eax, 1 xor ebx, ebx int 0x80 ------------------------------------------------------------ 8. BRAINFUCK — brainfuck/index.bf ------------------------------------------------------------ Output langsung dari Brainfuck tanpa wrapper shell. Biru menjalankan bf interpreter, output = CGI response. Program ini menghasilkan:

Hello World

Brainfuck (bf 1.0)

Kode BF di-generate otomatis dari string ASCII. Contoh simple "Hi" dalam BF: ++++++++[>++++<-]>. Bisa lihat juga https://biru.dot.my.id/brainfuck/demo.bf ------------------------------------------------------------ 9. PASCAL — pascal/index.pas ------------------------------------------------------------ program hello; begin writeln('Content-Type: text/html; charset=UTF-8'); writeln; writeln('

Hello World

'); writeln('

Pascal 3.2.0 (Free Pascal)

'); end. Cara kerja: Biru kompilasi .pas -> binary via fpc, lalu eksekusi. ------------------------------------------------------------ 10. FORTRAN — fortran/index.f90 ------------------------------------------------------------ program hello implicit none write(*, "(A)") "Content-Type: text/html; charset=UTF-8" write(*, "(A)") "" write(*, "(A)") "

Hello World

" write(*, "(A)") "

Fortran (gfortran 8.5.0)

" end program hello Cara kerja: Biru kompilasi .f90 -> binary via gfortran, lalu eksekusi. ------------------------------------------------------------ 11. DENO — deno/index.ts ------------------------------------------------------------ console.log("Content-Type: text/html; charset=UTF-8\n"); console.log("

Hello World

"); console.log("

Deno 2.9.5

"); Cara kerja: Biru jalankan via deno run, output = CGI response. ------------------------------------------------------------ 12. DART — dart/index.dart ------------------------------------------------------------ void main() { print("Content-Type: text/html; charset=UTF-8"); print(""); print("

Hello World

"); print("

Dart 3.13.1

"); } Cara kerja: Biru kompilasi .dart -> kernel snapshot, lalu eksekusi. ============================================================ URL Test ============================================================ https://biru.dot.my.id/bash/ -> Bash https://biru.dot.my.id/perl/ -> Perl https://biru.dot.my.id/python/ -> Python https://biru.dot.my.id/ruby/ -> Ruby https://biru.dot.my.id/go/ -> Go https://biru.dot.my.id/c/ -> C https://biru.dot.my.id/nasm/ -> Assembly (NASM) https://biru.dot.my.id/brainfuck/ -> Brainfuck https://biru.dot.my.id/pascal/ -> Pascal https://biru.dot.my.id/fortran/ -> Fortran https://biru.dot.my.id/deno/ -> Deno (TypeScript) https://biru.dot.my.id/dart/ -> Dart https://biru.dot.my.id/server.sh/ -> Server Info https://biru.dot.my.id/catatan.txt -> Source code ini ============================================================