Skip to content

AirLang: A domain-specific language for aviation flight planning and operations, featuring a complete compiler toolchain with 7-phase compilation, and specialized aviation calculations. Deployed as a standalone application with comprehensive documentation and examples

License

Notifications You must be signed in to change notification settings

tishap27/AirLang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

208 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@                             @@
@@            __|__            @@
@@-------@--o--(_)--o--@-------@@
@@                             @@
@@        A I R L A N G        @@
@@                             @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Author: Tisha Patel

AirLang โœˆ๏ธ

A domain-specific programming language designed for aviation flight planning and dispatch operations

๐Ÿš€ NEW: Version 2.0 - Real-time METAR integration now available! Jump to v2.0 features โ†“

License: MIT Build Status Version


๐ŸŒ Version 2.0 - Real-Time METAR Integration

What's New

Automatic Weather Data Fetching

No more manual METAR entry! Just provide the airport ICAO code:

REQUEST METAR FROM "CYOW";  ^^ Fetches live data automatically!

Before v2.0 (Manual):

METAR: "METAR CYOW 290100Z 07006KT 15SM SKC 06/M02 A3038";

After v2.0 (Automatic):

REQUEST METAR FROM "CYOW";  ^^ That's it! Live data from AviationWeather.gov

Features

  • โœ… Real-time weather data from official AviationWeather.gov API
  • โœ… Automatic parsing - wind, temperature, visibility, altimeter, gusts
  • โœ… Multiple airports - fetch weather for entire route
  • โœ… Smart validation - comprehensive error handling with helpful messages
  • โœ… Backward compatible - all v1.0 code still works
  • โœ… Zero syntax changes - no parser or grammar modifications

Example Usage

REQUEST METAR FROM "KJFK";
REQUEST METAR FROM "CYOW";

MAIN {
    WEATHER {
        RUNWAYDATA {
            RUNWAYHEADING() WITHCONFIG {
                KJFK_RUNWAY: 040;
                CYOW_RUNWAY: 070;
            };
        } ENDRUNWAYDATA;
        
        WINDANALYSIS {
            WIND() WITHCONFIG {
                KJFK = HEADWIND();
                KJFK = CROSSWIND();
                CYOW = HEADWIND();
                CYOW = CROSSWIND();
            };
        } ENDWINDANALYSIS;
        
        SAFETYALERT {
            IF KJFK_WIND_GUST > 25 THEN
                PRINT {"WARNING: High gusts at KJFK - " + KJFK_WIND_GUST + "kt"};
            ENDIF;
        } ENDSAFETYALERT;
    } ENDWEATHER;
} ENDMAIN;

Output:

Fetching METAR for KJFK...
โœ“ METAR received for KJFK
Raw METAR: METAR KJFK 290151Z 04018G29KT 10SM -RA BKN050 12/04 A3021...

WARNING: High gusts at KJFK - 29kt

Variable values:
KJFK_WIND_DIR = 40
KJFK_WIND_SPEED = 18
KJFK_WIND_GUST = 29
KJFK_TEMP = 12
KJFK_HEADWIND = 18
KJFK_CROSSWIND = 0

Installation for v2.0

Requirements

  • Windows 10/11
  • Visual Studio 2022
  • vcpkg package manager

Setup Steps

  1. Install libcurl via vcpkg:
cd C:\vcpkg
.\vcpkg install curl:x64-windows
  1. Clone and build:
git clone https://github.com/tishap27/AirLang.git
cd AirLang
git checkout v2.0-metar-curl
  1. Open in Visual Studio:

    • Open Assignment1.sln
    • Build โ†’ Build Solution (Ctrl+Shift+B)
  2. Copy DLLs (automatic with Post-Build event or manual):

xcopy /y "C:\vcpkg\installed\x64-windows\bin\*.dll" "x64\Debug\"

Technical Implementation

New Components:

  • metarFetcher.c / metarFetcher.h - API communication layer
  • Modified handleRequestStatement() - ICAO code detection
  • Enhanced error handling with aviation-specific validation

Architecture Highlights:

  • Zero breaking changes - existing v1.0 code runs unmodified
  • Parser-transparent - detection at execution time, not parsing
  • Modular design - METAR fetching isolated in a separate module
  • Error handling - comprehensive validation with user-friendly messages

Error Handling Examples

Invalid ICAO code:

REQUEST METAR FROM "CYOWW";
ERROR: Invalid METAR request format: 'CYOWW'

Valid formats:
  1. ICAO Code (4 letters):  REQUEST METAR FROM "KJFK";
  2. Full METAR string:      REQUEST METAR FROM "METAR KJFK 290151Z ...";

Your input 'CYOWW' doesn't start with 'METAR'. Manual entries must begin with 'METAR '.

Network failure:

ERROR: Failed to fetch METAR for 'KJFK'
Please check:
  - ICAO code is correct (e.g., KJFK, CYOW, EGLL)
  - Internet connection is active
  - AviationWeather.gov service is available

Version Comparison

Feature v1.0 v2.0
METAR Entry Manual string Automatic fetch OR manual
Data Source User provides AviationWeather.gov API
Error Handling Basic Comprehensive with hints
Network Support โŒ โœ… libcurl integration
Backward Compatible N/A โœ… All v1.0 code works

๐Ÿ“– Full v2.0 Documentation | ๐Ÿ”ง Migration Guide | ๐Ÿ“ Changelog


๐ŸŒŸ Why AirLang?

AirLang is a specialized domain-specific language engineered for aviation operations and flight planning workflows. Designed with aviation professionals in mind, it features native aviation syntax and comprehensive safety validation to streamline flight dispatch and planning processes.

BRIEFING {
    AIRCRAFT {
        AircraftID: C-GNBL;
        AircraftType: "Piper Cherokee PA-28-140";
    }
    ROUTE {
        DepartureCoords: 45.3225, -75.6692;  ^^ Ottawa (CYOW)
        ArrivalCoords: 43.6777, -79.6248;    ^^ Toronto (CYYZ)
    }
} ENDBRIEFING;

DISPATCH {
    Distance = AIRPATH;  ^^ Automatic great circle calculation
    PRINT {"Flight distance: " + Distance + " nautical miles"};
} ENDDISPATCH;

Output:

AIRCRAFT DATABASE: Loaded PA-28-140 configuration
Flight distance: 196.10 nautical miles
DISPATCH STATUS: CLEARED FOR DEPARTURE

๐Ÿš€ Quick Start

Download

  1. Download: โฌ‡๏ธ AirLang ZIP
  2. Extract to any folder (e.g., C:\AirLang)
  3. Open Command Prompt in that folder and run:
   airlang install
  1. Restart your terminal and type:
    airlang help

Usage

airlang run flight_plan_demo.txt
airlang help
airlang version

Build from Source

1. Clone: git clone https://github.com/tishap27/AirLang.git
2. Open AirLang.sln in Visual Studio 2022
3. Build โ†’ Build Solution (Ctrl+Shift+B)
4. Run: x64\Debug\airlang.exe your_flight_plan.air

๐Ÿ“‹ Key Features

โœˆ๏ธ Aviation-Native Syntax

  • Aircraft IDs: C-GNBL (automatic ICAO validation)
  • Flight Numbers: AL123 (IATA format checking)
  • Coordinates: 45.3225, -75.6692 (precision validation)
  • Weather: Native METAR parsing

๐Ÿ›ก๏ธ Safety-First Design

  • Compile-time validation of weight limits
  • Automatic checking of fuel capacity constraints
  • Center of gravity boundary enforcement
  • Weather minimums validation

๐Ÿงฎ Built-in Aviation Mathematics

  • Great Circle Navigation: Sub-1% accuracy using Haversine formula
  • Wind Components: Automatic headwind/crosswind calculations
  • Weight & Balance: Complete CG analysis with safety margins
  • Performance: Fuel burn, flight time, ground speed calculations

๐Ÿ“Š Workflow Integration

BRIEFING โ†’ WEATHER โ†’ LOADSHEET โ†’ DISPATCH

Mirrors real aviation documentation structure

๐Ÿ—๏ธ Architecture

AirLang features a complete 7-stage compiler pipeline:

Source Code โ†’ Lexical Analysis โ†’ Parser โ†’ Semantic Analysis โ†’ Code Generation โ†’ Bytecode โ†’ Virtual Machine

Technical Highlights

  • 237+ VM Instructions optimized for aviation calculations
  • Finite State Automata for aviation identifier recognition
  • Recursive Descent Parser with BNF grammar
  • Stack-based Virtual Machine with type safety
  • Custom Mathematical Library for navigation precision

๐Ÿ“– Examples

Flight Planning

MAIN {
    BRIEFING {
        AIRCRAFT {
            AircraftID: C-GNBL;
            AircraftType: "Piper Cherokee PA-28-140";
            MaxTakeoffWeight: 2150;
        }
        ROUTE {
            DepartureCoords: 45.3225, -75.6692;
            ArrivalCoords: 43.6777, -79.6248;
        }
    } ENDBRIEFING;
    
    LOADSHEET {
        PassengerCount: 3;
        PassengerWeight = PassengerCount * 170;
        TotalWeight = EmptyWeight + PassengerWeight + FuelWeight;
        
        IF TotalWeight > MaxTakeoffWeight THEN
            PRINT {"WARNING: Exceeds MTOW"};
        ENDIF;
    } ENDLOADSHEET;
    
    DISPATCH {
        Distance = AIRPATH;
        PRINT {"Flight cleared for " + Distance + " nm"};
    } ENDDISPATCH;
} ENDMAIN;

Weather Analysis

WEATHER {
    RECEIVEDDATA {
        METAR: "METAR CYOW 251630Z 27015G25KT 5000 -RA BKN008 OVC015 08/06 A2995 RMK";
    } ENDRECEIVEDDATA;
    
    RUNWAYDATA {
        RUNWAYHEADING() WITHCONFIG {
            CYOW_RUNWAY: 070;
        };
    } ENDRUNWAYDATA;
    
    WINDANALYSIS {
        CYOW = HEADWIND();
        CYOW = CROSSWIND();
    } ENDWINDANALYSIS;
} ENDWEATHER;

More examples in /examples directory.

๐Ÿ“š Documentation

Resource Description
User Guide Complete programming reference
Language Syntax All language constructs and grammar
Tokens Reference Built-in aviation functions
VM Architecture Virtual machine instruction set
Examples Sample programs and tutorials

๐ŸŽฏ Use Cases

  • General Aviation: Pre-flight planning and weight-balance
  • Aviation Students: Learning aviation mathematics
  • Researchers: Modeling aviation workflows and safety constraints
  • Flight Schools: Teaching flight planning calculations

๐Ÿ“Š Performance

Metric Value
Compilation Speed 41-164ms for typical programs
Navigation Accuracy ยฑ0.1 nautical miles
Memory Usage <50MB for complex flight plans
Supported Aircraft 15+ built-in configurations

๐Ÿ”ง Development

Project Structure

/
โ”œโ”€โ”€ src code           # Compiler source code
โ”œโ”€โ”€ examples/          # Sample AirLang programs
โ”œโ”€โ”€ docs/              # Complete documentation
โ”œโ”€โ”€ tests/             # Test suite
โ””โ”€โ”€ standalone/        # Compiled executables

Building

# Debug build
make debug

# Release build
make release

# Run tests
make test

๐Ÿค Contributing

AirLang is designed as an educational and research project. Contributions welcome:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

See CONTRIBUTING.md for detailed guidelines.

๐ŸŽ“ Academic Context

This project was developed as part of Computer Engineering Technology program at Algonquin College, demonstrating:

  • Compiler Design Principles applied to domain-specific languages
  • Aviation Domain Expertise informing language design
  • Safety-Critical Software development practices
  • Complete Software Engineering lifecycle

Academic Research Paper: AirLang: A Domain-Specific Language for Aviation Flight Planning and Operations

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Contact

Tisha Patel


โญ Star this repository if AirLang helped you understand domain-specific languages or aviation programming!

Built by a pilot who codes

About

AirLang: A domain-specific language for aviation flight planning and operations, featuring a complete compiler toolchain with 7-phase compilation, and specialized aviation calculations. Deployed as a standalone application with comprehensive documentation and examples

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published