Back to Projects

P-Dev

A lightweight, embeddable scripting language with C-like syntax, written in C++

Overview

P-Dev is a small, embeddable scripting language with C-like syntax, written in C++. It supports dynamic typing, first-class functions, closures, loops, conditionals, arrays, and more. The language features a unique arrow syntax for variable assignment.

Key Features

  • Dynamic typing with int, float, string, and array types
  • Arrow syntax for assignment (-> operator)
  • First-class functions with nested calls
  • Control flow: if/elif/else, for, while, do-while
  • Loop control: break, continue, pass
  • Compound assignment operators (+=, -=, *=, /=)
  • User input via read() function

Technical Details

The interpreter is built in C++17 with a custom lexer, parser, and interpreter. It supports lexical scoping, comments (// and /* */), and produces clear error messages. The project includes a comprehensive test suite for language features.

Development Challenges

Implementing the parser for operator precedence and nested expressions required careful design. Adding support for closures while maintaining lexical scoping added complexity to the variable resolution mechanism.