Skip to content

m-ahmad3/Compiler-Project-VigoLang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ VigoLang

A Satirical Pakistani Political Programming Language

Phase 1 Phase 2 License

A satirical, Urdu-inspired programming language that uses Pakistani political terminology as programming constructs.


Compiler Construction Project
University of Central Punjab | Fall 2025

πŸ“– Overview

VigoLang is an educational programming language designed for learning compiler construction principles. It features a unique syntax inspired by contemporary Pakistani political discourse, transforming political terminology into programming constructs.

⚠️ Disclaimer: This language is purely satirical and academic. The creator has no political affiliation or association with any political party or organization.

✨ Features

Feature Description
🎭 Satirical Keywords 20 unique keywords from Pakistani political terminology
πŸ”§ Custom Operators Unique operators like +:, -:, *:, :=, =?, >?, <?
πŸ“ Distinctive Syntax Double braces {{ }}, double brackets [[ ]], @ terminator
🎯 Identifier Prefix All variables start with ^ for zero keyword conflicts
πŸ” Complete Compiler Lexical analyzer (Phase 1) + Syntax analyzer (Phase 2)

πŸ—‚οΈ Project Structure

Compiler-Project-VigoLang/
β”œβ”€β”€ πŸ“ Phase_1/                         # Lexical Analyzer (Phase 1)
β”‚   β”œβ”€β”€ scanner.l                       # Flex scanner specification
β”‚   β”œβ”€β”€ test_program.vigo               # Sample VigoLang program
β”‚   β”œβ”€β”€ tokens.txt                      # Tokenization output
β”‚   β”œβ”€β”€ errors.txt                      # Error log
β”‚   β”œβ”€β”€ PHASE_1_REPORT.pdf              # Compiled report
β”‚   β”œβ”€β”€ DEMO_VigoLang.mp4               # Demo video
β”‚   └── πŸ“ Test_With_Explicit_Errors/   # Error testing
β”‚       β”œβ”€β”€ test_with_errors.vigo       # Test program with errors
β”‚       β”œβ”€β”€ tokens.txt                  # Tokenization output
β”‚       └── errors.txt                  # Error log
β”‚
β”œβ”€β”€ πŸ“ Phase_2/                         # Syntax Analyzer (Phase 2)
β”‚   β”œβ”€β”€ parser.y                        # YACC parser specification
β”‚   β”œβ”€β”€ scanner.l                       # Modified scanner for parser
β”‚   β”œβ”€β”€ valid_program.vigo              # Valid test program
β”‚   β”œβ”€β”€ invalid_program.vigo            # Invalid test program (error demo)
β”‚   β”œβ”€β”€ VigoLang_Phase_2_Document.pdf   # Compiled report
β”‚   β”œβ”€β”€ vigolang_parser                 # Compiled parser executable
β”‚   β”œβ”€β”€ lex.yy.c                        # Generated scanner C code
β”‚   β”œβ”€β”€ y.tab.c                         # Generated parser C code
β”‚   └── y.tab.h                         # Generated parser header
β”‚
β”œβ”€β”€ LICENSE                             # MIT License
└── README.md                           # This file

πŸš€ Quick Start

Prerequisites

  • GCC Compiler
  • Flex (Lexical Analyzer Generator)
  • Bison (Parser Generator)

Phase 1: Lexical Analysis

cd Phase_1

# Compile the scanner
flex scanner.l
gcc lex.yy.c -o vigo_scanner -lfl

# Run the scanner
./vigo_scanner test_program.vigo

Phase 2: Syntax Analysis

cd Phase_2

# Generate parser and scanner
flex scanner.l
bison -d parser.y

# Compile
gcc lex.yy.c y.tab.c -o vigolang_parser -lfl

# Test with valid program
./vigolang_parser valid_program.vigo

# Test with invalid program (see error handling)
./vigolang_parser invalid_program.vigo

πŸ“š Language Reference

Keywords (20 Total)

Keyword Purpose Standard Equivalent
ghq Main function main
safehouse Class definition class
nro Return statement return
order_hai If condition if
doosra_order Else-if else if
warna_vigo Else else
long_march For loop for
jab_tak_missing While loop while
deal_ho_gai Break break
chaltay_raho Continue continue
farmaan Print/Output print
taftish Input input
qaidi_no Integer type int
bayania String type string
float_sarkar Float type float
ishara Character type char
namaloom Void type void
ain Constant const
neutral Boolean true true
janwar Boolean false false

Operators

Operator Description Example
+: Addition ^a +: ^b
-: Subtraction ^x -: 5
*: Multiplication ^p *: ^q
:= Assignment ^x := 10
=? Equality ^x =? ^y
>? Greater than ^a >? ^b
<? Less than ^x <? 10
<< Output stream farmaan << ^msg
>> Input stream taftish >> ^val

Punctuation

Symbol Description
@ Statement terminator
{{ }} Block delimiters
[[ ]] Expression delimiters
, Separator
#* *# Multi-line comment
### Single-line comment

πŸ’» Sample Program

#* VigoLang Factorial Calculator *#

ghq[[ ]] {{
    qaidi_no ^num := 5@
    qaidi_no ^fact := 1@
    qaidi_no ^i := 1@
    
    farmaan << "Calculating factorial"@
    
    order_hai [[ ^num <? 0 ]] {{
        farmaan << "Error: Negative"@
    }}
    warna_vigo {{
        long_march [[ ^i := 1@ ^i <? ^num +: 1@ ^i := ^i +: 1 ]] {{
            ^fact := ^fact *: ^i@
        }}
    }}
    
    farmaan << ^fact@
    nro 0@
}}

πŸ“Š Parser Output

Successful Parse

╔════════════════════════════════════════════════════════╗
β•‘         VigoLang Syntax Analyzer v2.0                  β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

   βœ“ Variable declaration parsed
   βœ“ Conditional statement (order_hai) parsed
   βœ“ For loop (long_march) parsed
   βœ“ Program structure validated

╔════════════════════════════════════════════════════════╗
β•‘         SYNTAX ANALYSIS SUCCESSFUL!                    β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Syntax Error

╔════════════════════════════════════════════════════════╗
β•‘              SYNTAX ERROR DETECTED                     β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
  Line Number:    5
  Error Type:     syntax error
  Found Token:    'farmaan'

πŸ“ Documentation

πŸŽ₯ Demo

See the demo video for a complete walkthrough of the lexical analyzer.

πŸ‘¨β€πŸ’» Author

Muhammad Ahmad
Registration: L1F22BSCS0634
University of Central Punjab
Compiler Construction - Fall 2025

πŸ“„ License

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


Made with ❀️ for Compiler Construction

"Where politics meets programming"

About

A compiler for VigoLang, a satirical programming language for a Compiler Construction project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors