Maintainer's Corner

Readme for SCRIPTWriter-1.0.1

SCRIPT Writer

ESCRIPT: a human readable language for programming Bitcoin scripts

SCRIPT Writer defines a human friendly Bitcoin SCRIPT language and provides a set of functions to translate programs written in this extended language (called ESCRIPT, which is an acronym for Extended SCRIPT) to Bitcoin SCRIPT bytecode. See below for the syntax description, or visit https://vm100.cs.stir.ac.uk/~rkl/docu.php.

The extended language is a superset of the bytecode SCRIPT language. This means that it is possible to define a script partially using extended syntax constructions, and partially in direct streams of bytecode. Bytecodes are passed through the parser as-is.

Installation

# On some machines it is required to first manually install happy:<br/>
stack install happy<br/>
# Install Script Writer and all of its dependencies (other than Happy)<br/>
stack install

Applying the tool

The executable (SCRIPTWriter-exe) can be executed in any directory of this repository through Stack as follows: stack exec SCRIPTWriter-exe -- arguments

Call SCRIPTWriter-exe, with the custom script in stdin.

For example, if file scriptA contains a script written in the human friendly language, run the following in Bash: stack exec SCRIPTWriter-exe -- < scriptA

Some example scripts can be found in folder scripts/

The custom syntax

The supported syntax is described below.
Instructions on how to interpret the description:
- The "*" symbol specifies a repeated parsing of 0 or more times
- The "+" symbol specifies a repeated parsing of 1 or more times
- The "|" specifies an or (either parses following the left hand
side or the right hand side)
- The ".." specifies a range of allowed characters.
Any amount of whitespace is allowed between each instruction and between
the PUSH keyword and the subsequent bytestring. Parsing starts by applying the
Start rule. Anything after "#" on a line is treated as a comment (similar to how comments work in Bash).\