Skip to content
/ psylla Public

Extensible and embeddable Psylla language implementation written in Java

License

Notifications You must be signed in to change notification settings

urbic/psylla

Repository files navigation

Psylla logo

Psylla

Psylla is a scriptable interpretive concatenative homoiconic PostScript-like programming language.

The syntax of the language is based on postfix (reverse Polish) notation.

Psylla is implemented as a library written in Java.

Tag License Java CI Build Status OBS Build Result


Features

  • Dynamic arrays, strings, dictionaries, sets and streams
  • Arbitrary-precision rational arithmetic
  • Real and complex numbers
  • Multicontext execution (multithreading), synchronization primitives, blocking queues
  • Regular expressions (under construction)
  • REPL
  • Support for Java scripting API (JSR 223)

Examples

Here are three implementations of the procedure that calculates the factorial: recursive, iterative and stream-based.

/factorial
{
    dup iszero
    { pop 1 }
    { dup 1 sub factorial mul }
    ifelse
}
bind def
/factorial
{
    1 2 1 4 -1 roll { mul } for
}
bind def
/factorial
{
    1 1 3 -1 roll range 1 { mul } reduce
}
bind def

Calculating factorial of 50:

50 factorial toname say

More sample programs can be found in the dedicated directory.

Dependencies

Jar:

Java 21 (OpenJDK or Oracle JDK), JavaCC, Apache Ant, Apache Ivy, JUnit 4, JLine 1

Documentation:

Apache Ant, Apache Ivy, Docbook 5 XSL, Saxon HE 6, XSLTHL, SassC, Graphviz