0.2.1-c • Published 7 months ago

@p-lang/plang v0.2.1-c

Weekly downloads
-
License
LGPL-2.1-or-later
Repository
github
Last release
7 months ago

PLang

The P programming language

Last Commit GitHub code size in bytes GitHub top language

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

Unix:

curl -sSL https://raw.githubusercontent.com/p-programming-language/plang/main/install.sh | bash

Windows:

PowerShell:

Invoke-Expression (Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/p-programming-language/plang/main/install.ps1').Content

Command Prompt:

powershell -command "& { Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/p-programming-language/plang/main/install.bat' -OutFile 'install.bat'; .\install.bat; Remove-Item -Path 'install.bat' }"

Building from source:

Simply run:

npm run build

or:

yarn 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)