🌍 Pangea / Pang

A Prefix (Polish) Notation Language Interpreter in Lua

Welcome to Pangea Documentation

Pangea (also known as Pang) is a prefix notation (Polish notation) programming language implemented as an interpreter in Lua. It features a unique evaluation mechanism based on recursive descent and supports bilingual keywords (English and Italian).

Quick Facts

What is Polish Notation?

In Polish (prefix) notation, operators come before their operands:

Standard Infix:

5 + 6 → Result: 11

Polish Prefix (Pangea):

add 5 6 → Result: 11

This notation eliminates the need for parentheses and operator precedence rules. Everything is evaluated left-to-right based on each operator's arity (number of arguments).

Key Features

🔤 Bilingual Support

Write programs in English or Italian:

// English
print add 5 6

// Italian
stampa somma 5 6

🔧 Core Capabilities

🎯 How It Works

The interpreter operates in three main phases:

Tokenization program_words() Parse Tree phrase_length() Evaluation evaluate_word() Split input into tokens Calculate expression sizes Execute recursively

Getting Started

Running Pangea

# REPL mode
lua src/pangea1/main.lua

# Execute a file
lua src/pangea1/main.lua tests/fizzbuzz.words

# Italian mode
lua src/pangea1/main.lua italian tests/fizzbuzz.parole

# Execute file then enter REPL
lua src/pangea1/main.lua tests/factorial.words -

Your First Program

hello.words

print " Hello, World! "
print add 40 2

Output:

Hello, World!
42

Learn More

Explore the documentation sections:

💡 Philosophy

Pangea was designed as an exploration of Polish notation as a programming paradigm. By eliminating infix operators and parentheses, it creates a consistent, unambiguous syntax where every expression follows the same pattern: operator arg1 arg2 ... argN