Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

p-programming-language/plang

Repository files navigation

Plang

The P programming language

Last Commit GitHub code size in bytes GitHub top language npm

license

testing njsscan sarif

Why?

becuz im bored

Examples

Check out examples/ for some examples.

Tools

  • pint
    • The P interpreter CLI
  • repl
    • A read-eval-print loop to run P interactively inside of your terminal
  • ast-viewer
    • This is an interactive terminal where you can inspect the AST or bound AST of a provided source code node-by-node

Developer only tools

  • test
    • Runs unit tests

Installation

Installation using NPM:

npm i -g @p-lang/plang

Custom install / self building

git clone https://github.com/p-programming-language/plang && cd plang

now just run:

npm i && npm run build

Then you can access our tools using:

npm run <tool>

or:

yarn run <tool>

Current Features

  • Type analysis & hoisting before parsing
  • Tokenizing:
    • Number literals (int, float)
    • String literals, supports both single and double quotes
    • Boolean literals
    • Identifiers
    • Keywords
    • Symbols (+, -, etc.)
    • Comments (## single line, ##: multi line :##)
  • Parsing + Binding + Type checking + Interpreting:
    • Literals
      • Basics (numbers, strings, booleans)
      • String interpolations
      • Ranges
      • Array literals/types
      • Object literals/types
    • Array/object indexing
    • Binary expressions (including compound assignment, is, is in, etc.)
    • Unary expressions (including ++, --, #, typeof, etc.)
    • Variable declarations (mutability optional)
    • Variable assignment (:= and = operators)
    • Property assignment
    • Function declarations and calls

Planned Features

  • Type guards (value is T, T extends U, asserts T, T extends U ? V : Q)
  • Intrinsic types
  • Spread types
  • Parenthesized types
  • Type casting (value as T)
  • Throw statement
  • Switch statement
  • Classes (in progress, someone else do this shit)