Skip to content

blancas/tinypost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1afc540 · Jun 17, 2013

History

21 Commits
Jun 17, 2013
May 23, 2013
May 28, 2013
May 23, 2013
May 26, 2013
May 23, 2013

Repository files navigation

Tinypost

A tiny PostScript interpreter.

It uses an ANTLR3 lexer and a Java Exception class as a form of longjmp to get out of (possibly nested) loops. There is support for most of the core language but not for graphics.

Sample Usage

Input file:

$ cat src/main/resources/fact.ps
/factorial {
  dup 0 eq {
    pop 1
  } {
    dup 1 sub
    factorial
    mul
  } ifelse
} def

6 factorial =  %% Prints this result
10 factorial   %% returns this result

Load the main namespace:

(use 'blancas.tinypost.main)

Use runf to run a ps file and get the resulting operand stack.

(runf "src/main/resources/fact.ps")
;; 720
;; [3628800]

Use run to evaluate ps code and get the resulting operand stack.

(run "3 4 +")
;; [7]

To Do

  • Make host program data available to ps code.

License

Copyright © 2013 Armando Blancas.

Licensed under the Eclipse Public License.

About

A tiny PostScript interpreter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published