# @p-lang/plang

> A general-purpose, statically-typed, interpreted language.

Latest version **0.2.1-c** (published 2023-10-14) · LGPL-2.1-or-later license · 0 weekly downloads

## Install

```sh
npm install @p-lang/plang
pnpm add @p-lang/plang
yarn add @p-lang/plang
bun add @p-lang/plang
```

Provides the command `pint`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1-c |
| Published | 2023-10-14 |
| First published | 2023-10-13 |
| Weekly downloads | 0 |
| License | LGPL-2.1-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 13.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | KevinAlavik |
| Maintainers | runicly, pufferisadev |
| Keywords | p, plang, language |

## Links

- npm: https://www.npmjs.com/package/@p-lang/plang
- Repository: https://github.com/p-programming-language/plang
- Homepage: https://github.com/p-programming-language/plang#readme
- Issues: https://github.com/p-programming-language/plang/issues
- npm.io page: https://npm.io/package/@p-lang/plang

## Dependencies (12)

- [os](https://npm.io/package/os.md) ^0.1.2
- [mocha](https://npm.io/package/mocha.md) ^10.2.0
- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [cmd-ts](https://npm.io/package/cmd-ts.md) ^0.13.0
- [should](https://npm.io/package/should.md) ^13.2.3
- [express](https://npm.io/package/express.md) ^4.18.2
- [colors.ts](https://npm.io/package/colors.ts.md) ^1.0.20
- [sync-fetch](https://npm.io/package/sync-fetch.md) ^0.5.2
- [typescript](https://npm.io/package/typescript.md) ^5.2.2
- [readline-sync](https://npm.io/package/readline-sync.md) ^1.4.10
- [to-camel-case](https://npm.io/package/to-camel-case.md) ^1.0.0
- [@types/to-camel-case](https://npm.io/package/@types/to-camel-case.md) ^1.0.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.2.1-c (latest) — 2023-10-14
- 0.2.1-b — 2023-10-14
- 0.2.1-a — 2023-10-13

## README

# PLang
The P programming language

![Last Commit](https://img.shields.io/github/last-commit/p-programming-language/plang)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/p-programming-language/plang)
![GitHub top language](https://img.shields.io/github/languages/top/p-programming-language/plang)

![license](https://img.shields.io/github/license/p-programming-language/plang)

[![testing](https://github.com/KevinAlavik/plang/actions/workflows/test.yml/badge.svg)](https://github.com/KevinAlavik/plang/actions/workflows/test.yml)
[![njsscan sarif](https://github.com/p-programming-language/plang/actions/workflows/njsscan.yml/badge.svg)](https://github.com/p-programming-language/plang/actions/workflows/njsscan.yml)

## Why?
becuz im bored

## Examples
Check out **[examples/](https://github.com/p-programming-language/plang/tree/main/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:
```bash
curl -sSL https://raw.githubusercontent.com/p-programming-language/plang/main/install.sh | bash
```
### Windows:
PowerShell:
```powershell
Invoke-Expression (Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/p-programming-language/plang/main/install.ps1').Content
```
Command Prompt:
```bash
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:
```bash
npm run build
```
or:
```bash
yarn run build
```
**Then you can access our [tools](https://github.com/p-programming-language/plang?tab=readme-ov-file#tools) using:**
```bash
npm run <tool>
```
or:
```bash
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)

---
_Source: https://npm.io/package/@p-lang/plang · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
