AirLang

Domain-Specific Language for Aviation Flight Planning and Operations

A specialized programming language designed for aviation professionals, featuring natural syntax for flight operations, built-in aviation calculations, and comprehensive safety validation.

^^ Flight Planning in AirLang
MAIN {
  BRIEFING {
    AIRCRAFT { Registration: C-GEGL; }
    FLIGHT { Number: AL120; }
    ROUTE { 
      Departure: 45.3225, -75.6692;
      Arrival: 43.6777, -79.6248;
    }
  } ENDBRIEFING;
  
  LOADSHEET {
    Distance = AIRPATH;
    PRINT { "Flight Distance: " + Distance };
  } ENDLOADSHEET;
} ENDMAIN;

Built for Aviation Professionals

AirLang provides domain-specific abstractions that make flight planning code more readable, maintainable, and safer.

✈️

Aviation-Specific Types

Native support for aircraft identifiers (C-GNBL), flight numbers (AC180), coordinates, and weather data with automatic validation.

🧮

Built-in Calculations

Great circle distance (AIRPATH), wind components, fuel calculations, and weight & balance computations integrated into the language.

🛡️

Safety Validation

Compile-time checking of weight limits, fuel capacity, and regulatory constraints to prevent unsafe flight configurations.

🌦️

Real-Time Weather Integration NEW

Live METAR fetching from AviationWeather.gov API with automatic parsing, wind analysis, and real-time weather data integration.

📋

Structured Workflow

Block-structured syntax that mirrors standard aviation documentation practices and operational procedures.

Optimized Compiler

Complete 7-phase compiler implementation with aviation-specific optimizations and comprehensive error handling.

Compiler Architecture

Traditional compiler design enhanced with aviation-specific features

Step 1
Coder
Input handling & source file management
Step 2
Reader
Buffer management & character stream processing
Step 3
Scanner
Lexical analysis with aviation-specific tokenization
Step 4
Parser
Recursive descent parsing with domain validation
Step 5
Writer
Semantic analysis & safety constraint validation
Step 6
Generator
Bytecode generation optimized for aviation calculations
Step 7
Virtual Machine
Stack-based execution with aviation-specific opcodes
Output
Results
Execution results
15+
Aviation Data Types
40+
Language Keywords
200+
VM Instructions
5000+
Lines of Compiler Code

Code Examples

See how AirLang simplifies common aviation programming tasks

flight_plan.air
REQUEST METAR FROM "https://airlangMetar.fly";

MAIN {
    BRIEFING {
        AIRCRAFT { 
            Registration: C-GEGL;
            Type: "B737-800";
            MaxTakeoffWeight: 79000;
        }
        FLIGHT { 
            Number: AC180; 
            Date: '2025-05-15';
            DepartureTime: "14:30Z";
        }
        ROUTE { 
            Departure: 45.3225, -75.6692;  ^^ CYOW Ottawa
            Arrival: 43.6777, -79.6248;    ^^ CYYZ Toronto
        }
    } ENDBRIEFING;
    
    LOADSHEET {
        Distance = AIRPATH;
        CruiseSpeed = 450;
        FlightTime = Distance / CruiseSpeed;
        
        PRINT { "Flight Distance: " + Distance + " nm" };
        PRINT { "Estimated Flight Time: " + FlightTime + " hours" };
    } ENDLOADSHEET;
} ENDMAIN;
weight_balance.air
MAIN {
    LOADSHEET {
         ^^ Aircraft Configuration
        AircraftType: "C172";  ^^ Loads certified database entry
        PassengerCount = 3;
        BaggageWeight = 50;
        EstimatedFuelRequired = 300;
        
        ^^ Weight & Balance Calculations
        TotalWeight = TOTALWEIGHT;           ^^ Automatic calculation
        CenterOfGravity = CENTEROFGRAVITY;   ^^ CG position from datum
        WeightMoment = WEIGHTBAL;            ^^ Total moment calculation
        
        ^^ Safety Validation
        ValidationStatus = VALIDATEWB;       ^^ Returns 1 if within limits
        
        PRINT { "Aircraft: Cessna 172 Skyhawk" };
        PRINT { "Total Weight: " + TotalWeight + " lbs" };
        PRINT { "CG Position: " + CenterOfGravity + " inches" };
        
         ^^ Center of Gravity Validation 
        IF WeightBalanceStatus != 1 THEN 
		PRINT { "WARNING: Weight & Balance OUT OF LIMITS" };
		PRINT { "CG Position: " + CenterOfGravity + " inches from datum" }; 
		PRINT { "CG Position may be unsafe - Check loading!" };
        ENDIF;
    } ENDLOADSHEET;
} ENDMAIN;
weather_check.air
MAIN {
    WEATHER {
        RECEIVEDDATA {
	    ^^ Process METAR data
            METAR: "CYOW 151400Z 24015G25KT 10SM FEW030 SCT100 M02/M08 A3012";
        } ENDRECEIVEDDATA;
        
        WINDANALYSIS {
	    ^^ Wind Calculations
            WIND() WITHCONFIG {
                CYOW = HEADWIND();
                CYOW = CROSSWIND();
            };
        } ENDWINDANALYSIS;
	RUNWAYDATA { 
            RUNWAYHEADING() WITHCONFIG { 
                CYOW_RUNWAY: 070; 
	    }; 
        } ENDRUNWAYDATA; 
        
        SAFETYALERT {
            IF CYOW_WIND_GUST > 20 THEN 
		PRINT{"ALERT: Excessive gusts at CYOW - " + CYOW_WIND_GUST + "kt (Limit: 20kt)"}; 
            ENDIF; 
 
            IF CYOW_CROSSWIND > 15 THEN 
                PRINT{"WARNING: High crosswind at CYOW - " + CYOW_CROSSWIND + "kt(Limit: 15kt)"}; 
           ENDIF;
        } ENDSAFETYALERT;
    } ENDWEATHER;
    
    DISPATCH {
        REPORT {
            PRINT { " Headwind: " + CYOW_HEADWIND + "kt" }; 
	    PRINT { " Crosswind: " + CYOW_CROSSWIND + "kt" }; 
        } ENDREPORT;
    } ENDDISPATCH;
} ENDMAIN;

🌦️ Live Weather Data from AviationWeather.gov API

No manual METAR entry required - fetch real-time weather data directly from the API!

live_weather.air
^^ Request live METAR from API
REQUEST METAR FROM "CYOW";
REQUEST METAR FROM "KJFK";

MAIN {
    WEATHER {
        RECEIVEDDATA {
            ^^ Automatically fetches latest weather
            METAR: "CYOW";  ^^ Live from AviationWeather.gov
            METAR: "KJFK";  ^^ Parsed automatically
        } ENDRECEIVEDDATA;
        
        RUNWAYDATA {
            RUNWAYHEADING() WITHCONFIG {
                CYOW_RUNWAY: 070;
                KJFK_RUNWAY: 040;
            };
        } ENDRUNWAYDATA;
        
        WINDANALYSIS {
            ^^ Wind components calculated from live data
            WIND() WITHCONFIG {
                CYOW = HEADWIND();
                CYOW = CROSSWIND();
                KJFK = HEADWIND();
                KJFK = CROSSWIND();
            };
        } ENDWINDANALYSIS;
    } ENDWEATHER;
    
    DISPATCH {
        REPORT {
            PRINT { "Weather data received and analyzed" };
        } ENDREPORT;
    } ENDDISPATCH;
} ENDMAIN;
→ Fetching METAR for CYOW...
✓ METAR received for CYOW
Raw METAR: METAR CYOW 292300Z 06006KT 15SM FEW060 FEW250 06/M01 A3014
→ Fetching METAR for KJFK...
✓ METAR received for KJFK
Raw METAR: METAR KJFK 292351Z 05012KT 10SM FEW030 OVC042 12/07 A3012
Weather variables automatically extracted:
CYOW_WIND_DIR = 60 | CYOW_WIND_SPEED = 6 | CYOW_TEMP = 6
CYOW_HEADWIND = 5.91 | CYOW_CROSSWIND = 1.04

KJFK_WIND_DIR = 50 | KJFK_WIND_SPEED = 12 | KJFK_TEMP = 12
KJFK_HEADWIND = 11.82| KJFK_CROSSWIND = 2.08
📡 Live API Integration
Direct connection to AviationWeather.gov - always current data
⚡ Automatic Parsing
Wind, temp, visibility, pressure extracted instantly
🌍 Multiple Airports
Fetch unlimited stations in a single script
🛡️ Error Handling
Graceful fallback with detailed error messages

Roadmap

Exciting features and enhancements planned for future releases

📡

Real-time Weather APIs

Integration with live METAR/TAF feeds and real-time weather data sources

📊

Performance Optimization

Advanced fuel burn calculations, climb/descent profiles, and route optimization

🛰️

ACARS Integration

Connect with aircraft communication systems for real-time flight data

🏢

Fleet Management

Multi-aircraft operations, crew scheduling, and fleet-wide optimization tools

🎓 Academic Research Project

Research Publication

This project was developed as part of the CST8152 Compilers course at Algonquin College, demonstrating practical application of compiler construction techniques to domain-specific language development.

Read Full Paper Technical Documentation