SCRIPTWriter 1.0 → 1.0.1
raw patch · 3 files changed
+14/−10 lines, 3 files
Files
- README.md +8/−5
- SCRIPTWriter.cabal +1/−1
- lib/Bitcoin/Script/Parser/SyntaxExtension.hs +5/−4
README.md view
@@ -1,11 +1,13 @@ # SCRIPT Writer -## ESCRIPT: a human friendly language for programming Bitcoin scripts+## 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. +The language can be tried out at https://vm100.cs.stir.ac.uk/~rkl/home.html (at the bottom of the page, beneath "Serialization of a script:").+ #### Installation Dependency: Haskell's Stack (https://docs.haskellstack.org/en/stable/install_and_upgrade/) @@ -21,7 +23,7 @@ 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, and optionally passing some arguments (call the tool with first argument 'help' for information regarding 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 @@ -41,15 +43,16 @@ Start rule. Anything after "\#" on a line is treated as a comment (similar to how comments work in Bash).\ -Start := Instruction*+Start := (Whitespace* Instruction | Whitespace* Byte)* Whitespace* -Instruction := Push | Mnemonic | Byte\-Push := "PUSH" Bytestring | "PUSH" Integer\+Instruction := Push | Mnemonic\+Push := "PUSH" Whitespace* Bytestring | "PUSH" Whitespace* Integer\ Integer := "i" Num+ | "i-" Num+\ Num := "0".."9"\ Bytestring := Byte+\ Byte := Hexadecimal Hexadecimal\ Hexadecimal := "0".."9" | "a".."f" | "A".."F"\+Whitespace := " " | "\\t" | "\\n" | "\\r"\ Mnemonic := "OP_0" | "OP_FALSE" | "OP_PUSHDATA1" | "OP_PUSHDATA2"\ | "OP_PUSHDATA4" | "OP_1NEGATE" | "OP_RESERVED" | "OP_1"\ | "OP_2" | "OP_3" | "OP_4" | "OP_5"\
SCRIPTWriter.cabal view
@@ -5,7 +5,7 @@ -- hash: 1c6bbe5bc9b52aa84b36d7f60d203b0659e0417aa622f18a395aa7f0818cd7b2 name: SCRIPTWriter-version: 1.0+version: 1.0.1 description: Please see the README on Github at https://github.com/RKlompUU/SCRIPTWriter homepage: https://github.com/RKlompUU/SCRIPTWriter bug-reports: https://github.com/RKlompUU/SCRIPTWriter/issues
lib/Bitcoin/Script/Parser/SyntaxExtension.hs view
@@ -30,17 +30,18 @@ \\t\t side or the right hand side)\n\ \\t - The \"..\" specifies a range of allowed characters.\n\ \Any amount of whitespace is allowed between each instruction and between\n\- \the PUSH keyword and the subsequent bytestring. Parsing starts by applying\n\+ \the PUSH keyword and the subsequent bytestring. Parsing starts by applying the\n\ \Start rule. Anything after \"#\" on a line is treated as a comment (similar\n\- \to how comments work in Bash).\n\n\n\- \Start := (Instruction | Byte)*\n\n\+ \to how comments work in Bash). ESCRIPT's grammar is as follows.\n\n\n\+ \Start := (Whitespace* Instruction | Whitespace* Byte)* Whitespace*\n\n\ \Instruction := Push | Mnemonic\n\- \Push := \"PUSH\" Bytestring | \"PUSH\" Integer\n\+ \Push := \"PUSH\" Whitespace* Bytestring | \"PUSH\" Whitespace* Integer\n\ \Integer := \"i\" Num+ | \"i-\" Num+\n\ \Num := \"0\"..\"9\"\n\ \Bytestring := Byte+\n\ \Byte := Hexadecimal Hexadecimal\n\ \Hexadecimal := \"0\"..\"9\" | \"a\"..\"f\" | \"A\"..\"F\"\n\+ \Whitespace := \" \" | \"\\t\" | \"\\n\" | \"\\r\"\n\ \Mnemonic := " ++ intercalate ("\n" ++ take (length "Mnemonic :") (repeat ' ') ++ "| ") mnemonics