Skip to content

Vāṇī is a logic-based programming language built in Prolog. It focuses on clarity, expressiveness, and simplicity, supporting core features like arithmetic, conditionals, loops, and strings. Designed for education and experimentation in language design.

Notifications You must be signed in to change notification settings

pkumsi/VANI-a-logic-based-programming-language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SER502-Vani-Team38

Vāṇī is a logic-based programming language built in Prolog. It focuses on clarity, expressiveness, and simplicity, supporting core features like arithmetic, conditionals, loops, and strings. Designed for education and experimentation in language design.

Team Info

Team Name: Vani
Team Number: Team 38 Course: SER502 – Languages and Programming Paradigm Project: Project: Compiler and Virtual Machine for a Programming Language

System Requirements

  • OS: Linux / MacOS / Windows (WSL recommended)
  • Language: Prolog (SWI-Prolog recommended)
  • Tools: Definite Clause Grammars (DCG)

Tools Used

  • SWI-Prolog
  • DCG for grammar
  • Custom-built lexer, parser, and runtime in Prolog
  • GitHub for version control

Vani Tokenizer and Parser.

This project implements a Tokenizer and Parser for a custom imperative language called Vani, written in Prolog using Definite Clause Grammars (DCGs). The language includes constructs like define, bet, finna, say, etc, and more—designed to resemble a playful blend of programming and Gen Z slang.

Project Structure

  • src/tokenizer.pl – Tokenizes GenZLang code into structured tokens
  • src/parser.pl – Parses tokens into an abstract syntax tree (AST)
  • src/evaluator.pl - Core interpreter logic for GenZLang. Evaluates parsed AST structures.
  • data/ – Sample input and test cases
  • executor.sh/ – Bash script for easy program execution (MacOS)
  • executor.bat/ – Bat script for easy program execution (Windows)

Installation Instructions

Ubuntu:

bash

sudo apt install swi-prolog

how to build and run

  • Step 1:Open the terminal and run
swipl

  • Step 2: Load the modules
?- [tokenizer].
?- [parser].
?- [evaluator]
  • Step 3: Run a Parse Query
?- parse("define x as 5; say x;", Tree).

output :

Tree = program([
    define(x, number(5)),
    print(identifier(x))
]).

How to Run from Terminal

Step 1:

Ensure the Bash script is executable (MacOS)

chmod +x executor.sh 

Ensure the Bat script is executable (Windows)

.\executor.bat data\program1

What executor.sh does ?

Purpose : Acts as the entrypoint to run a GenZLang program from a file.

Invokes Prolog interpreter with finalExecute.pl as the main module.

Takes a file path as an argument (e.g., data/program3).

Passes that file into the run/0 predicate in finalExecute.pl.

What finalExecute.pl does ?

Purpose: The main driver that ties together the tokenizer, parser, and evaluator to run a full GenZLang program.

Reads a .genz source file passed via command-line (from executor.sh).

Uses tokenizer.pl to convert the source string into tokens.

Uses parser.pl to parse the tokens into an abstract syntax tree (AST).

Uses evaluator.pl to execute the AST and produce output (e.g., printing strings or numbers).

Step 2: Execute your program

For MacOS:

bash executor.sh data/program1 

For Windows:

.\executor.bat data\program1

Sample output (MacOS) : samplerun.png

Sample output (Windows) : samplerun_windows.jpg

Project presentation - Demo Video

Watch our full demo here: YouTube Link

About

Vāṇī is a logic-based programming language built in Prolog. It focuses on clarity, expressiveness, and simplicity, supporting core features like arithmetic, conditionals, loops, and strings. Designed for education and experimentation in language design.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •