0.0.11 • Published 1 month ago

patrim v0.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Patrim Cauthon

Sa souvraya niende misain ye.

Patrim is a goofy little term rewriting language, implemented in Typescript. Incomplete documentation is available at the Patrim website.

Patrim was inspired by Modal.

Example

A simple program that prints "Hello, world!" 3 times:

// Define a symbol for the string "Hello, world!"
:: hello "Hello, world!"

// Repeat something `n` times.
:: (repeat 0 ?s) undefined
:: (repeat ?n:number ?s) (
  ?s ;
  repeat (?n - 1) ?s
)

// Define a shorthand for calling `console.info`. Note that `print` matches
// its argument eagerly.
:: (print !s) (((#global . console) . info) (?s))

repeat 3 (print hello)

Evaluating the program:

$ pc hello.pat

Hello, world!
Hello, world!
Hello, world!

Installation

$ npm -g install patrim

Usage

To evaluate the contents of a file or files, use pc:

$ pc [options] <file>...

The resulting rewritten term will be printed to stdout. Pass --interactive to open an interactive session after evaluating the given files, if any:

$ pc --interactive
? :: hello "Hello, world!"
rule-36: hello => Hello, world!
? hello
'Hello, world!'
? #exit 0
$

For complete usage information, see pc --help.

VS Code integration

See patrim-vscode for VS Code integration.

0.0.11

1 month ago

0.0.10

1 month ago

0.0.9

1 month ago

0.0.8

1 month ago

0.0.6

1 month ago

0.0.5

1 month ago

0.0.4

1 month ago

0.0.3

1 month ago

0.0.2

1 month ago

0.0.1

1 month ago