跳到正文
Hacker News (official RSS)(github.com)·· 2 小時前品質評分49

JOVIAL J73 編譯器,讓 1959 年的軍用程式跑在現代電腦上

Jovial J73 Compiler

重點導讀

JOVIAL 是 1959 年設計的程式語言,曾用在 F-16、B-2 等飛機的飛行控制系統。

  • 現在有了 JOVIAL J73 編譯器,可以把這種舊語言寫的程式轉成現代電腦能直接執行的程式,也能轉成 C 程式碼。像範例中的費波那契數列,就能在現代電腦上跑起來。這個工具讓人能在一般電腦上重溫早期軍用軟體開發,也可能幫上需要處理舊 JOVIAL 程式的人。
  • 不過作者提到,目前編譯器會用到 LLVM,正考慮改用 C 重寫。

AI 伴隨問答

自備 Key 深度分析

針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:

正文

A fully functional native compiler for JOVIAL J73 (MIL-STD-1589C), a programming language from 1959 designed for bombing things more accurately. Now you too can experience the joy of military avionics software development from your gaming PC.

Please note:

I wrote this whilst learning Rust (mistake) and kind of applied a tutorial which heavily featured LLVM. Hence this compiler. I'm currently looking at doing a rewrite in C, also JOVIAL is still featured in embedded software. Running LLVM which is a heck of a dependency is not a good idea in the embedded space.

So please watch out for the rewrite (I've also done a version of this in OCaml but thats neither here nor there)

What is JOVIAL?

JOVIAL (Jules' Own Version of the International Algebraic Language) was created in 1959 because apparently FORTRAN wasn't violent enough. It was used extensively in:

  • F-16 Fighting Falcon flight control systems
  • B-2 Spirit stealth bomber
  • Various missiles (the ones that find you)
  • Other things the government won't tell us about

It's basically what happens when the Pentagon asks "what if ALGOL, but angrier?"

Features

This compiler goes harder than it has any right to:

  • Native Code Generation - Compiles to actual x86-64 machine code via LLVM. Not interpreted. Not transpiled. Real electrons doing real work.
  • C Transpiler - For when you need to see what cursed code you've written in a language humans can read
  • Full J73 Support - Variables, procedures, tables, STATUS enums, the whole military-industrial complex
  • I/O - PRINT and READ because even fighter jets need to say hello sometimes
  • LSP Integration - Yes, there's a Language Server. Yes, you can get IntelliSense for a language older than the moon landing.

Installation

Option 1: Download Prebuilt Binaries (Recommended)

Grab a release from the Releases page. Unzip. Run. Pretend it's 1959.

Platform File
Windows x64 jovialc-x86_64-pc-windows-msvc.zip
Linux x64 jovialc-x86_64-unknown-linux-gnu.tar.gz
macOS ARM jovialc-aarch64-apple-darwin.tar.gz

Option 2: Build From Source

For those who enjoy suffering:

# Clone this bad boy
git clone https://github.com/Zaneham/jovial

# Download LLVM 18 and tell Rust where it is
export LLVM_SYS_180_PREFIX=/path/to/llvm

# Build it
cargo build --release

# Question your life choices

Requirements (for building)

  • Rust (latest stable)
  • LLVM 18 (set LLVM_SYS_180_PREFIX to your LLVM installation)
  • A deep appreciation for military history
  • Questionable decision-making skills

Usage

# The easy way - compile straight to executable
jovialc myprogram.jov -f exe

# Run your 1959-era code at 2025 speeds
./myprogram

# Or specify an output name
jovialc myprogram.jov -f exe -o bomber.exe

Output Formats

Flag Output Use Case
-f exe Executable Just works. Compiles and links automatically.
-f c C source code When you want to see the horror
-f llvm LLVM IR When you want to see more horror
-f object Native .o file When you need manual control
-f ast AST dump Debugging (or masochism)

Hello World

START HELLO;

PRINT('Hello from 1959!');

TERM

Yes, TERM instead of END. Yes, strings use single quotes. Yes, semicolons everywhere. Welcome to the past.

Fibonacci (Because We Must)

START FIBONACCI;

ITEM N S 32 = 10;
ITEM A S 32 = 0;
ITEM B S 32 = 1;
ITEM TEMP S 32 = 0;
ITEM I S 32 = 0;

PRINT('Fibonacci sequence:');

WHILE I < N;
    PRINT(A);
    TEMP := A + B;
    A := B;
    B := TEMP;
    I := I + 1;
END

TERM

Output:

Fibonacci sequence:
0
1
1
2
3
5
8
13
21
34

It runs. On your modern computer. In native code. A language designed when computers were the size of rooms is now printing Fibonacci numbers faster than the original programmers could blink.

Fun Facts

  • JOVIAL was standardised as MIL-STD-1589. There have been multiple revisions. People cared about this.
  • The language uses ' in identifiers like CURRENT'WAYPOINT. This is called an "apostrophe identifier" and it's exactly as cursed as it sounds.
  • Arrays use 1-based indexing AND parentheses for access. WAYPOINTS(5) is array access, not a function call. The parser just has to figure it out.
  • There are people alive today who wrote production JOVIAL code. Some of them are probably on LinkedIn.

Why Does This Exist?

  1. Preservation of computing history
  2. A deep and concerning interest in military aviation software
  3. To prove it could be done
  4. I wasn't going to play video games anyway (lie)
  5. Someone, somewhere, might have legacy JOVIAL code they need to compile
  6. The LSP was already done and needed a friend

Technical Details (For The Brave)

┌─────────────────────────────────────────────────────────────┐
│                    JOVIAL J73 Compiler                      │
├─────────────────────────────────────────────────────────────┤
│  Source (.jov)                                              │
│       ↓                                                     │
│  Lexer (Logos) → Tokens                                     │
│       ↓                                                     │
│  Parser (Recursive Descent) → AST                           │
│       ↓                                                     │
│  Semantic Analysis → Symbol Table, Type Checking            │
│       ↓                                                     │
│  LLVM Codegen (inkwell) → LLVM IR                          │
│       ↓                                                     │
│  LLVM Backend → Native Object File                          │
│       ↓                                                     │
│  Linker → Executable                                        │
│       ↓                                                     │
│  Your code runs on silicon that would blow the minds        │
│  of every engineer who worked on the original compilers     │
└─────────────────────────────────────────────────────────────┘

Related Projects

If you've made it this far, you're clearly interested in languages that predate common sense. Good news: there's more where this came from.

The Vintage LSP Collection

Because syntax highlighting is a human right, even for languages the Geneva Convention forgot:

Project What It Is Why It Exists
jovial-lsp Language Server for JOVIAL IntelliSense for bombing things
hals-lsp HAL/S Language Server The Space Shuttle's favourite
cms2-lsp CMS-2 Language Server US Navy missiles deserve autocomplete
coral66-lsp CORAL 66 Language Server British military computing, stiff upper lip included
mumps-lsp MUMPS Language Server Healthcare IT from the shadow realm
chill-lsp CHILL Language Server Telecom switches and existential dread
racf-lsp IBM RACF Language Server Mainframe security, now with squiggly lines
IBM-system360-lsp System/360 COBOL & PL/I For when you need to debug your grandfather's code

The Emulator Menagerie

When compilers aren't enough and you need to simulate entire extinct and new computers:

Project What It Emulates Level of Concerning
Conway RISC-V & x86 binary translator Moderate
voyager-fds-emulator Voyager Flight Data Subsystem High
viking-marsrover-emulator Viking Mars Lander Very High
minuteman-computer-emulator Minuteman missile guidance FBI watchlist
setun70-emulator Soviet trinary computer Cold War nostalgia

Other Sins Against Modern Computing

  • Plankalkuel - An interpreter for the world's first programming language (1948). Yes, before FORTRAN. Yes, it works.
  • chill-compiler - Because one vintage compiler wasn't enough
  • SLATEC.jl - Mathematical libraries from the 70s, now in Julia
  • z390Zane - Mainframe assembler and emulator. For the full experience.

If you're seeing a pattern here, congratulations. You've identified a problem.

Contact

Found a bug? Want to discuss the finer points of MIL-STD-1589C? Simply need to tell another human being that you write JOVIAL and have them not immediately change the subject?

zanehambly@gmail.com

I can't promise I'll fix your problem, but I can promise I'll be unreasonably interested in it. If you're maintaining legacy avionics code and need moral support, I'm your man. If you're from the Pentagon and this compiler somehow ended up in something important, I would like to state for the record that I included a test suite.

Based in New Zealand, where it's already tomorrow and the sheep outnumber the JOVIAL programmers roughly eight million to one.

License

Apache License 2.0. Do whatever you want with it, no strings. See LICENSE.

Acknowledgments

  • The US Department of Defense, for creating this beautiful mess
  • LLVM, for making this possible without hand-writing x86 assembly
  • Rust, for making me feel safe while doing deeply unsafe things
  • The youtuber Low Level for his course on Rust which helped me learn the language a bit. You can check out his youtube here: https://www.youtube.com/@LowLevelTV
  • You, for reading this far. You're my kind of weird.

讀者討論

理性交流 · 即時討論