Skip to content

deathtothecorporation/pallas-clean

Repository files navigation

Pallas

An open source Solid State Interpreter exokernel and runtime

Index

  1. Introduction
  2. Caveats
  3. Installation
  4. Getting Started
  5. Example
  6. Contributing
  7. Additional Resources

Introduction

The Pallas SSI programming environment is a virtual machine which is also a database engine. Databases are created by writing pure functions which fold their streams of incoming events, at each step returning an output event and possibly an upgraded version of itself.

Let's pick that apart. The foundation of Pallas is untyped, but conceptually we can say that a database is a function of the type DB:

type DB = Input -> (Output, DB)

If a user supplies such a function, the Pallas runtime will create a database using a snapshot-and-event-log system. The user can write their programs as if they were keeping their data "in memory", without any need for manual persistence or other forms of cache management.

The recursive part of the type above might seem strange. You can think of it almost as a normal stateful function:

type OtherDB = (State, Input) -> (State, Output)

The difference is that instead of changing the state value, the recursive version would change itself. The current version of the function is the state. In other words: programs can upgrade themselves dynamically. Code can construct code. Because of this, we can put an entire compiler toolchain inside the system; the programs it generates have zero dependencies on the outside world.

New compilers can and should be written, but at the moment the only practical language on Pallas is Sire. Sire is purely functional and can be thought of as a sort of Lispy-Haskell whose syntax is slightly more readable and flexible than S-expressions, without sacrificing regularity or metaprogramming capabilities. Sire is designed primarily to be useful when bootstrapping more advanced compilers, but its extensibility together with the power of composing pure functions makes it quite capable and fun to use even on its own. Sire is untyped, but by importing a macro it can be given a type system.

For all programs written in Sire, Pallas provides the following features out of the box, without any special configuration or external libraries:

  • Automatic orthogonal persistence
  • Extreme portability and trust profile (the only dependency is the runtime, and we have a completely dependency free and realistically auditable C runtime under development)
  • Merkleized and deduplicated state with content-addressable memory pages (data, code, running programs)
  • Natively networked with public keys as endpoints
  • Serializable closures that can be transferred over the network
  • Parallel execution

This project is a fork of Plunder.

Caveats

Despite being in development for over four years, Pallas is still considered to be a prototype implementation. Anything explicitly mentioned in this README or the documentation does work as advertised, but other areas of the repo are less complete, including:

  • TODO: Haskell runtime
  • TODO

Installation

Quick Start (Ubuntu/Debian-based and MacOS)

The quickest way to run Pallas is by installing a few dependencies and grabbing a pre-built binary.

  1. Install dependencies:

Dependencies:

  • libgmp (GNU Multiple Precision Arithmetic Library)
  • liblmdb (Lightning Memory-Mapped Database)
  • libz (zlib compression library)

On Ubuntu or Debian-based systems, you can install these with:

sudo apt-get update && sudo apt-get install -y \
    libgmp10 \
    liblmdb0 \
    zlib1g

On MacOS, Homebrew is a good option (assumes you have Homebrew installed):

brew install gmp lmdb zlib
  1. Get a prebuilt binary:

Currently we provide the following prebuilt binaries:

Your browser may not prompt to download these files, in which case you can use cURL:

curl -L <URL of your choice here> -o pallas

Make it executable and move it somewhere on your path.

  1. Run it:

If all went well, you should see this:

$ pallas

Run a Pallas machine

Usage: pallas COMMAND

  Pallas

Available options:
  -h,--help                Show this help text

Available commands:
  sire                     Run a standalone Sire repl.
  save                     Load a sire file and save a seed.
  show                     Print a seed file.
  repl                     Interact with a seed file.
  start                    Resume an idle machine.
  boot                     Boot a machine.
  1. Get a Sire REPL:

Clone this repository and navigate to its root. Then run:

$ pallas sire sire/prelude.sire
...
...
("prelude","LOADED FROM CACHE!")

}
} ==== Sire REPL ====
}
} Since input is multi-line, there is currently no input-prompt.
} Just type away!
}

(Ctrl-C to get out of the REPL)

Get a Development Environment

Using Nix is the most straightfoward way to install Pallas at this time. If your system doesn't support Nix or if you need further instruction (including instructions for Docker), refer to the documentation.

  1. Clone this repo. Navigate to the root of it.
git clone git@github.com:operating-function/pallas.git
cd pallas
  1. Get into a Nix shell
nix develop
  1. Build pallas

This will take some time. Perhaps upwards of 15 minutes, depending on your system.

stack build
  1. Confirm everything is working by dropping into a Sire REPL:
$ stack run pallas sire sire/prelude.sire
...
...
("prelude","LOADED FROM CACHE!")

}
} ==== Sire REPL ====
}
} Since input is multi-line, there is currently no input-prompt.
} Just type away!
}

Getting Started

COMING SOON: Quick start instructions for a todo list app with automatic persistence.

Example

Sire is the programming language of Pallas.

Here is a brief look at Sire. The documentation covers the language more fully, but we want you to get a sense of it now.

If you are following along, use the instructions above to get a Sire REPL.

Top-level binding

; This is a comment.

; Top-level binding of 3 to x:
x=3

Function application

(add 1 3)
; ^ function name (add)
;    ^ first argument (1)
;      ^ second argument (3)

4 ; return value
| add 1 3
4   ; return value
add-1-3
4
; Binding a named function
= (addTwo input)
| add 2 input


; Applying it
(addTwo 4)
6

Rows

row=[10 64 42]

; idx is a function that returns a particular index in a row

(idx 0 row)
10
; the zeroth item in the row

(idx 2 row)
42

Demo Examples

COMING SOON: An /examples filled with more complex Sire procedures.

Contributing

At this stage in Pallas development, these are the types of contributions that are most appropriate:

  • Bugs in the existing examples
  • New examples
  • Documentation improvements
  • New GitHub issues for parts of the system that are unclear

That said, we encourage you to dive even deeper and submit PRs beyond these suggestions.

CONTRIBUTING.md

Additional Resources

About

test bed for the clean history Pallas repo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published