Imported from bauripalash/pankti (AGENTS.md). Install upstream with npx skills add bauripalash/pankti. Copyright stays with the author.
AGENTS.md - Pankti Programming Language
Project Overview
Pankti (পঙক্তি) is a dynamically typed programming language designed for
programming in Bengali, English, Bengali phonetic and combinations for them. It
is implemented primarily in C.
Pankti Language Syntax Guide
Pankti supports three syntax modes that can be mixed freely.
- Bengali: Native Bengali Script
- Phonetic Bengali: Bengali words written in Latin script.
- English: Standard English keywords
Keywords
| Concept |
Bengali |
Phonetic |
English |
| Variable declaration |
ধরি |
dhori |
let |
| Function declaration |
কাজ |
kaj |
func |
| If condition |
যদি |
jodi |
if |
| Then |
তাহলে |
tahole |
then |
| Else |
নাহলে |
nahole |
else |
| While loop |
যতক্ষণ |
jotokhon |
while |
| Do (loop body) |
করো |
koro |
do |
| End block |
শেষ |
sesh |
end |
| Return |
ফেরাও |
ferao |
return |
| Import module |
আনয়ন |
anoyon |
import |
| Logical And |
এবং |
ebong |
and |
| Logical Or |
বা |
ba |
or |
| True |
সত্যি |
sotti |
true |
| False |
মিথ্যা |
mittha |
false |
| Nil (null) |
নিল |
nil |
nil |
| Break |
ভাঙো |
bhango |
break |
| Continue |
চালাও |
chalao |
continue |
Operators
Arithmetic
| Operator |
Description |
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
** |
Exponentiation |
% |
Modulo |
Comparison
| Operator |
Description |
== |
Equal |
!= |
Not Equal |
> |
Greater Than |
>= |
Greater Then or Equal |
< |
Less Than |
<= |
Less Than or Equal |
Logical
| Bengali |
Phonetic |
English |
Description |
এবং |
ebong |
and |
Logical AND |
বা |
ba |
or |
Logical OR |
! |
! |
! |
Logical NOT |
Built-in Functions
| Bengali |
Phonetic |
English |
Description |
Arguments |
দেখাও() |
dekhao() |
show() |
Print values to output |
Any numbers |
আয়তন() |
ayoton() |
len() |
Get length of Array, Strings etc. |
1 |
সংযোগ() |
songjog() |
append() |
Append value to array |
2 |
সময়() |
somoy() |
clock() |
Get current time |
0 |
গোলমাল() |
golmal() |
error() |
Throw a runtime error and halt execution |
1 |
প্রেরণমান() |
preronman() |
args() |
Get arguments passed to the script |
0 |
Data Types
Numbers
Pankti Supports Bengali and Arabic numerals and mixture of them both.
১২৩৪৫
12345
৩.১৪
9৯.৯9
Strings
"পলাশ বাউরি"
"Hello world"
Booleans
সত্যি, true, sotti
মিথ্যা, false, mittha
Arrays
["পলাশ", "বাউরি", 3.14, সত্যি]
Nil
nil
নিল
Maps/Hash tables
{
"নাম" : "পলাশ",
"পদবী" : "বাউরি"
"সময়" : ১২.১২
}
Variable Declaration
// Bengali
ধরি নাম = "পলাশ"
// Phonetic
dhori nam = "Palash"
// English
let name = "Palash"
Functions
// Bengali
কাজ যোগ(ক, খ)
ফেরাও ক + খ
শেষ
// Phonetic
kaj jog(a, b)
ferao a + b
sesh
// English
func add(a, b)
return a + b
end
Function Call
add(5, 5)
যোগ(৫, ৫)
If-Then-Else Conditional
// Bengali
যদি <শর্ত> তাহলে
# কিছু কাজ
নাহলে
# কিছু কাজ
শেষ
// Phonetic
jodi <condition> tahole
# some work
nahole
# some work
end
// English
if <condition> then
# some work
else
# some work
end
While Loop
// Bengali
যতক্ষণ <শর্ত> করো
# কিছু কাজ
শেষ
// Phonetic
jotokhon <condition> koro
# some work
sesh
// English
while <condition> do
# some work
end
Subscripting
ধরি তালিকা = [১,২,৩]
ধরি তথ্য = { "নাম" : "পলাশ", ১ : ২ }
তালিকা[০] //১
তথ্য["নাম"] // পলাশ
Comments
// Single line comment
File Extension
Pankti source files use .pn extension. .pank are also valid for legacy purpose.
Architecture Overview
Source Tree Structure
src/
alloc.h # Memory Allocation Utilities
argparse.h # Argument Parsing System
ast.h # Abstract Syntax Tree definitions
bengali.h # Bengali characters handling
builtins.h # Built-in Functions
compiler.h # Bytecode Compiler
core.h # Core runtime
defaults.h # Default values used across the project
diagonctx.h # Parsing, Compiling, Runtime Diagnostics handling
flags.h # Feature flags for runtime
gc.h # Garbage Collector
gfx.h # Pankti to Graphics backend connector (Drawing, Text
Shaping, Input Handling)
gfx_constants.h # Graphics related constants (Color names, Key names)
keywords.h # Keyword definitions (Bengali, English, Phonetic)
lexer.h # Lexer interface
object.h # Object System (Values, Strings, Functions etc.)
opcode.h # Bytecode Opcodes
panktiterms.h # Terminology used throught the project
parser.h # Parser
printer.h # Writing to output device interface
pstdlib.h # Pankti Standard Library definitions
ptypes.h # Type definitions (u8, u16, u32, u64)
strescape.h # Helper to escape characters like \n, \t \xHH, \uHHHH etc in strings
strpool.h # String Interning handler
symtable.h # Symbol Table for Compiler/VM
system.h # OS Detection and Other OS related utilities
terminal.h # Terminal related utilities
token.h # Token definitions
unicode.h # Unicode and Grapheme related utilities
ustring.h # Codepoint Iterator interface
utils.h # Utilities
version.h # Version definition
vm.h # Virtual Machine
Compilation Pipeline
- Lexer (
src/lexer.c): Token source code.
- Parser (
src/parser.c): Build Abstract Syntax Tree from tokens.
- Compiler (
src/compiler.c): Generate Bytecode from AST
- Virtual Machine (
src/vm.c): Stack-based virtual machine executing bytecode.
Graphics Backend
For Standard Library's Graphics module pankti current uses Tigr library (https://github.com/erkkah/tigr).
Build System
CMake (Primary)
# Configure Debug Build
cmake -B build -DCMAKE_BUILD_TYPE=Debug
# Configure Release Build
cmake -B build -DCMAKE_BUILD_TYPE=Release
# Build Pankti Binary
cmake --build build --target pankti
Build Options
| Option |
Default |
Description |
USE_NAN_BOXING |
ON |
Enable NaN-boxed values |
BUILD_GFX |
ON |
Build with graphics standard library support |
CMAKE_BUILD_TYPE |
Debug |
Build type: Debug, Release, RelWithDebInfo |
C Language Standard
- C11 is required
- GNU extensions enabled for GCC builds
Naming Conventions
| Type |
Convention |
Example |
| Functions |
PascalCase |
NewLexer(), VmPush(), GcCollect() |
| Structs/Types |
PascalCase with P prefix |
PVm, PObj, PEnv, Pgc |
| Macros |
UPPER_SNAKE_CASE |
GC_OBJ_THRESHOLD, OP_CONST |
| Local variables |
camelCase |
frameCount, objCount |
| Type aliases |
all lowercase |
u8, u16, u32, u64 |
| Static functions |
camelCase with prefix |
vmError(), vmPrintStackTrace() |