Prism Language Transpiler
raw JSON → 0.1.6 verified Fri May 01 auth: no javascript
Prism is a small, expressive programming language that transpiles to TypeScript or JavaScript. Current stable version is 0.1.6, released as a work-in-progress. It supports typed variables, functions, classes, pattern matching, and error handling. Differentiator: designed as an alternative language that compiles to JS/TS with modern syntax features. Active development with CLI tools for compile, run, and check.
Common errors
error Error: Cannot find module 'prism-lang' ↓
cause Package not installed or not in node_modules.
fix
Run
npm install prism-lang. error prism: command not found ↓
cause CLI binary not in PATH.
fix
Install globally:
npm install -g prism-lang error SyntaxError: Unexpected token 'pub' ↓
cause Using Prism-specific syntax in JavaScript/TypeScript.
fix
Compile .prism files with the prism CLI before using.
Warnings
gotcha Prism is a work in progress; syntax may change without major version bump. ↓
fix Pin to a specific version and monitor releases for breaking changes.
gotcha Type inference is limited; explicit type annotations may be required in complex expressions. ↓
fix Add explicit type annotations when inference fails.
gotcha CLI requires `npm link` or global install; otherwise commands may not be found. ↓
fix Run `npm install -g prism-lang` or use `npx prism compile`.
Install
npm install prism-lang yarn add prism-lang pnpm add prism-lang Imports
- compile wrong
const compile = require('prism-lang')correctimport { compile } from 'prism-lang' - run wrong
import * as prism from 'prism-lang'; prism.run(...)correctimport { run } from 'prism-lang' - check wrong
import { check } from 'prism-lang/check'correctimport { check } from 'prism-lang'
Quickstart
// compile.prism
final name: string = "Prism"
mut count: int = 0
fn greet(name: string): string {
return "Hello, " + name
}
print(greet("World"))
// CLI: prism compile file.prism --js