In a conditional primitive, evaluate the condition.
-
Pairs
Evaluate the first argument if necessary
-

Perform the reduction if the first argument is in normal form
-
Lists
Evaluate the scrutinee
-

If the scrutinee is Nil, perform the appropriate reduction.
-
References
@@ -368,7 +368,7 @@ evaluated as False (Related Topics
diff --git a/doc/build/html/searchindex.js b/doc/build/html/searchindex.js
index 925be43..86bd861 100644
--- a/doc/build/html/searchindex.js
+++ b/doc/build/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({"docnames": ["commentary/gm", "commentary/layout-lexing", "commentary/ti", "glossary", "index", "references/gm-state-transitions", "references/ti-state-transitions"], "filenames": ["commentary/gm.rst", "commentary/layout-lexing.rst", "commentary/ti.rst", "glossary.rst", "index.rst", "references/gm-state-transitions.rst", "references/ti-state-transitions.rst"], "titles": ["The G-Machine", "Lexing, Parsing, and Layouts", "The Template Instantiator", "Glossary", "Welcome to rlp\u2019s documentation!", "G-Machine State Transition Rules", "Template Instantiator State Transition Rules"], "terms": {"index": 0, "modul": 1, "search": [], "page": [], "begin": [0, 1, 5, 6], "tblr": [], "ccclc": [], "hline": [], "": [0, 1, 3, 5, 6], "d": [0, 5, 6], "h": [0, 5, 6], "bmatrix": [0, 5, 6], "mathtt": [0, 5, 6], "nap": [5, 6], "a_1": [0, 5, 6], "a_2": [5, 6], "nind": [5, 6], "a_3": 6, "end": [0, 1, 5, 6], "f": [0, 1, 5, 6], "impli": [], "thi": [0, 1, 2, 5], "i": [0, 1, 3, 5, 6], "normal": [1, 6], "paragraph": [], "what": [], "follow": [1, 5], "precompil": [], "latex": [], "equat": [], "math": [], "transrul": [0, 6], "test": [], "The": [1, 3, 4, 5], "spineless": [], "tagless": [], "g": [1, 4, 6], "machin": [2, 4], "wip": [0, 2], "here": 1, "typeset": [], "state": [1, 2, 4], "transit": 4, "rule": [1, 4], "describ": 1, "action": 5, "dereferenc": [], "indirect": [5, 6], "when": [0, 1, 5, 6], "pass": [0, 6], "function": [1, 5, 6], "argument": [0, 5, 6], "derefer": 6, "an": [0, 1, 3, 5, 6], "top": [0, 1, 3, 5, 6], "stack": [0, 1, 5, 6], "p": 6, "negat": [], "form": [1, 6], "nprim": 6, "neg": 5, "x": [0, 1, 5, 6], "nnum": [5, 6], "n": [0, 1, 5, 6], "perform": 6, "unari": [5, 6], "oper": [1, 5, 6], "o": 6, "e": [0, 1, 5, 6], "intern": [1, 6], "prim": 6, "constructor": 6, "unevalu": [], "b": 0, "nillist": [5, 6], "hopefulli": 2, "expand": 2, "thorough": 2, "explan": [], "evalu": [5, 6], "complet": [1, 5, 6], "singl": [0, 1, 6], "texttt": [], "remain": 6, "dump": [5, 6], "empti": [5, 6], "halt": [5, 6], "restor": [5, 6], "sub": 6, "comput": 6, "ha": [0, 1, 6], "reduc": [5, 6], "supercombin": [0, 1, 3, 5, 6], "updat": [0, 5, 6], "root": [0, 6], "beta": [5, 6], "a_0": [0, 5, 6], "ldot": [0, 5, 6], "a_n": [0, 5, 6], "nsupercomb": [0, 6], "x_1": [0, 6], "x_n": [0, 6], "text": [0, 1, 5, 6], "where": [0, 1, 5, 6], "instantiateu": [0, 6], "setcel": [0, 5, 6], "r": [], "2": [0, 1, 5], "c": [0, 1, 5, 6], "3": [0, 3, 6], "\u03b2": [], "caption": [], "figur": [], "gather": [], "tag": [], "1": [0, 1, 5, 6], "binari": [5, 6], "y": [1, 5, 6], "associ": [1, 6], "two": [1, 6], "both": [1, 6], "In": [1, 5, 6], "condit": [1, 6], "primit": [5, 6], "placehold": [], "walkthrough": 2, "textt": [], "ifp": 6, "reduct": [5, 6], "been": [5, 6], "true": 6, "conp": 6, "0": [0, 6], "mathbb": [], "fals": 6, "construct": 6, "ndata": 6, "out": [1, 6], "its": [0, 1, 5, 6], "t": [1, 6], "vdot": [5, 6], "a_": [5, 6], "style": 1, "languag": 1, "my": 1, "previou": [1, 5], "experi": 1, "have": [1, 5], "all": 1, "had": 1, "quit": [0, 1], "trivial": 1, "lexic": [], "analysi": 1, "stage": 1, "peak": 1, "complex": 1, "stream": 1, "token": 1, "lazili": 1, "task": [0, 1], "tokenis": 1, "veri": [0, 1], "simpl": [0, 1, 3], "descript": 1, "you": 1, "ignor": 1, "whitespac": 1, "point": [1, 5], "recognis": 1, "If": [1, 5, 6], "don": 1, "someth": [0, 1], "check": 1, "liter": 1, "identifi": [1, 5], "should": 1, "neither": 1, "return": 1, "error": 1, "On": 1, "paper": 1, "haskel": 3, "like": [0, 1], "seem": 1, "pose": 1, "few": 1, "greater": 1, "challeng": 1, "some": 1, "potenti": 1, "roadblock": 1, "mind": 1, "befor": 1, "make": 1, "attempt": 1, "were": 1, "sensit": 1, "while": [1, 5], "wa": [0, 1], "comfort": 1, "idea": [1, 3], "system": 1, "similar": 1, "python": [], "indent": 1, "dedent": 1, "us": [0, 1, 3], "section": [1, 3], "code": [0, 1, 3, 5], "wai": [0, 1], "felt": 1, "differ": 1, "onli": [0, 1], "user": 1, "defin": 1, "infix": 1, "preced": 1, "level": [1, 3], "recal": 1, "algorithm": 1, "look": 1, "up": [1, 5], "prefix": 1, "postfix": 1, "even": 1, "mixfix": 1, "global": [1, 5], "tabl": 1, "call": 1, "appropri": [1, 6], "parser": [0, 1], "also": [1, 5], "store": 1, "never": [1, 5], "modifi": [1, 5], "runtim": 1, "howev": 1, "could": 1, "nice": 1, "solut": [0, 1], "context": 1, "keyword": 1, "allow": [1, 3], "word": 1, "famili": 1, "role": 1, "from": [0, 1, 5], "_note": [], "found": [0, 1], "ghc": 1, "lexer": 1, "first": [1, 6], "ar": [0, 1, 5], "consid": [1, 5], "bodi": [0, 1], "relev": 1, "type": [0, 1], "declar": 1, "lex": 4, "pars": 4, "layout": [3, 4], "note": [1, 5], "list": 1, "ascend": 1, "intimid": 1, "factor": 1, "read": 1, "appear": 1, "which": [0, 1], "after": [1, 5], "case": [1, 3, 5], "els": 1, "express": [0, 1, 3], "etc": 1, "bit": 1, "thought": 1, "research": 1, "refer": [], "them": [1, 5], "easili": 1, "scariest": 1, "thing": 1, "thei": [0, 1], "achiev": 1, "we": [0, 1, 5], "compar": 1, "contrast": 1, "much": 1, "dismai": 1, "newlin": [1, 3], "separ": 1, "statement": 1, "resolv": 1, "scope": 1, "instead": [0, 1], "tradit": 1, "semicolon": 1, "brace": [], "see": 1, "bcpl": [], "http": [], "doc": [], "org": [], "lexical_analysi": [], "html": [], "dure": [0, 1], "new": [0, 1, 5], "line": 1, "appli": [0, 1, 5], "than": 1, "insert": 1, "push": [0, 1, 5], "onto": [0, 1, 5], "initialis": 1, "zero": [0, 1], "lesser": 1, "pop": [0, 1, 5], "until": 1, "each": 1, "equal": 1, "termin": 1, "leav": [1, 5], "ident": 1, "pretti": 1, "philosophi": 1, "one": 1, "correct": [1, 5], "answer": 1, "todo": [1, 3], "need": 1, "sourc": 1, "develop": 1, "our": [0, 1], "pattern": 1, "translat": 1, "explicitli": 1, "saw": 1, "most": [1, 3], "notabl": 1, "exampl": [1, 3], "implicitli": [1, 3], "why": 1, "am": 1, "so": [1, 5], "afraid": 1, "syntax": [1, 3], "A": 5, "primer": [], "But": [], "about": [], "mai": 1, "gener": 1, "To": 1, "frank": 1, "m": [1, 5], "far": 1, "less": 1, "scare": 1, "ask": 1, "myself": 1, "certainli": 1, "needn": 1, "concern": 1, "implicit": 1, "continu": [1, 5], "written": 1, "over": 1, "multipl": 1, "often": 1, "seen": 1, "somewhat": 1, "esoter": 1, "extrem": 1, "common": 1, "data": 1, "cry": 1, "right": 1, "now": 1, "sorri": 1, "anoth": 1, "format": 1, "odditi": 1, "anotherth": 1, "do": [0, 1], "align": [1, 3], "contiat": [], "enough": 1, "fear": 1, "let": 1, "actual": 1, "think": [1, 3], "implement": 1, "firstli": 1, "formal": 1, "mean": [0, 1, 5], "sai": 1, "order": [1, 5], "yield": 1, "thankfulli": 1, "u": [1, 3], "entri": 1, "clear": 1, "select": 1, "minor": 1, "except": 1, "elabor": 1, "being": [0, 1], "altern": [1, 3], "term": [1, 3], "link": 1, "glosarri": [], "cultur": 3, "infam": 3, "scari": 3, "mathemat": 3, "pleas": 3, "excus": 3, "realli": 3, "fun": 3, "glossari": [1, 4], "free": [1, 3], "variabl": [0, 3], "For": [1, 3], "purpos": 3, "just": [1, 3, 5], "definit": [1, 3], "possibl": [1, 3], "match": 3, "under": 1, "assumpt": [], "give": [], "lexem": 1, "next": 1, "file": [], "reach": 1, "henceforth": [], "denot": 1, "repres": 1, "subsequ": [], "column": 1, "number": [1, 5], "charact": 1, "must": [], "introduc": 1, "addit": [], "input": [], "handl": 1, "obvious": [], "would": 1, "requir": [1, 5], "string": 5, "help": [], "book": [], "keep": [0, 1], "tool": [], "good": [], "current": [1, 5], "cascad": 1, "element": 1, "either": 1, "nolayout": [], "indic": 0, "explicit": 1, "programm": [], "herself": [], "non": [0, 1], "integ": [], "enclos": 1, "rememb": [1, 5], "w": [0, 1], "10": [1, 5], "pure": [], "abov": [], "notic": 0, "accom": [], "langl": [1, 5], "rangl": [1, 5], "lastli": [], "compliment": [], "how": [1, 5], "close": 1, "preceed": 1, "provid": 5, "consequ": [], "ll": 1, "more": 1, "pedant": 1, "chapter": 1, "2010": 1, "report": 1, "heavili": 1, "referenc": 1, "manag": 1, "record": 1, "laid": 1, "start": 1, "item": 1, "belong": 1, "With": 1, "plai": 1, "set": [1, 5], "inform": 1, "otherwis": 1, "adequet": 1, "satisfi": 1, "basic": 1, "contin": 1, "varnoth": 1, "final": 1, "concept": 1, "virtual": 1, "re": 1, "moment": [0, 1], "exactli": 1, "compil": 1, "present": 1, "small": 1, "addition": 1, "open": 1, "observ": 1, "sampl": 1, "can": 1, "bind": [0, 1], "rather": 1, "focu": 1, "na\u00efv": 1, "eol": 1, "prove": 1, "unid": 1, "wait": 1, "comparison": 1, "nondescript": 1, "measur": 1, "numer": 1, "valu": [1, 5], "offsid": 1, "formalis": 1, "graphem": 1, "resid": 1, "exist": [0, 1, 5], "assum": 1, "print": 1, "delimit": 1, "last": 1, "distinct": 1, "between": 1, "come": 1, "partial": 1, "toward": 1, "respons": 1, "share": [1, 5], "content": 1, "same": 1, "shall": 1, "cover": 1, "includ": 1, "framework": 1, "time": [0, 1], "cannot": 1, "model": [0, 1], "simpli": [0, 1], "As": 1, "long": 1, "track": 1, "own": 1, "cope": 1, "fine": 1, "without": 1, "view": 1, "abstract": 1, "yet": 1, "decompos": 1, "discret": 1, "typic": 1, "linear": [0, 1], "recurs": 1, "down": 1, "big": 1, "reason": 1, "aim": 1, "tend": 1, "burden": 1, "necessari": [1, 6], "still": 1, "natur": 1, "orient": 1, "backtrack": 1, "difficult": 1, "ineleg": 1, "counterintuit": 1, "eleg": 1, "problem": 1, "minimis": 1, "rlp": [1, 3], "bnf": 1, "setlength": [], "grammarparsep": [], "20pt": [], "plu": [], "1pt": [], "minu": [], "grammarind": [], "12em": [], "grammar": [], "expr": [0, 1], "alt": [], "stat": [], "vopen": 1, "vclose": 1, "recov": 1, "treat": 1, "ensur": 1, "casepairp": 6, "_": 6, "scrutine": 6, "caselistp": 6, "nil": 6, "f_": 6, "con": 6, "initi": 0, "templat": [0, 4], "instanti": [0, 4, 5], "tim": [], "straightforward": 0, "core": 0, "design": 0, "major": 0, "achil": 0, "heel": 0, "interleav": 0, "heap": [0, 5], "node": [0, 5], "hold": 0, "uninstanti": 0, "raw": 0, "ast": 0, "straight": 0, "spot": 0, "lead": [], "loss": [], "travers": 0, "tree": [], "difficulti": [], "lower": [], "investig": [], "scstep": 0, "name": [0, 5], "tistat": 0, "st": 0, "rootaddr": 0, "drop": 0, "length": 0, "env": 0, "argbind": 0, "zip": 0, "argaddr": 0, "getarg": 0, "src": 0, "hello": [], "world": [], "process": 0, "goe": 0, "augment": 0, "environ": [0, 5], "local": 0, "remov": 0, "address": [0, 5], "newli": [0, 5], "4": 0, "structur": 0, "unfit": 0, "assembli": 0, "target": 0, "goal": 0, "sequenc": 0, "instruct": [0, 5], "execut": 0, "lookup": 5, "gmrule": 5, "pushglob": 5, "alloc": 5, "int": [0, 5], "creat": 5, "pushint": 5, "applic": 5, "directli": 5, "below": 5, "mkap": [0, 5], "_n": [], "tidi": 5, "slide": [0, 5], "unwind": [0, 5], "jump": 5, "nglobal": 5, "compiledsc": 0, "compilesc": 0, "scdef": 0, "gm": 0, "run": 0, "map": [0, 5], "enumer": 0, "Of": 0, "cours": 0, "rel": 0, "becom": 0, "inaccur": 0, "around": 0, "offset": 0, "compilec": 0, "app": 0, "argoffset": 0, "sneaki": 5, "trick": 5, "enabl": 5, "object": [], "digit": 5, "valid": 5, "abus": 5, "ad": [], "base": 5, "rep": 5, "5": 5, "effect": 5, "take": 5, "alreadi": 5, "impact": 5, "garbag": 5, "collect": 5, "intend": 5, "might": 5, "e_n": 5, "nth": 5, "ti": 0, "e_1": 5, "uninitialis": 5, "space": 5, "nuninitialis": 5, "whnf": 5, "eval": 5, "z": [], "plain": 5, "old": 5, "put": 5, "conflict": 5, "discard": [], "queue": 5, "buld": 5, "k": 5, "unappli": 5}, "objects": {}, "objtypes": {}, "objnames": {}, "titleterms": {"welcom": 4, "rlp": 4, "": 4, "document": 4, "indic": [], "tabl": [], "test": [], "page": [], "commentari": 4, "content": 4, "The": [0, 2], "spineless": [], "tagless": [], "g": [0, 5], "machin": [0, 5], "lex": 1, "pars": 1, "layout": 1, "rule": [5, 6], "refer": [1, 4], "A": 1, "lexic": 1, "primer": 1, "python": 1, "But": 1, "what": 1, "about": 1, "haskel": 1, "glossari": 3, "index": 4, "lone": 1, "brace": 1, "pair": 6, "list": 6, "templat": [2, 6], "instanti": [2, 6], "motiv": 0, "implement": [], "compil": 0, "how": [], "squash": 0, "tree": 0, "vine": 0, "theori": 0, "core": 5, "transit": [5, 6], "evalu": 0, "slurp": 0, "extens": 5, "lazi": 0, "state": [5, 6], "ti": []}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 60}, "alltitles": {"Lexing, Parsing, and Layouts": [[1, "lexing-parsing-and-layouts"]], "A Lexical Primer: Python": [[1, "a-lexical-primer-python"]], "But What About Haskell?": [[1, "but-what-about-haskell"]], "Parsing Lonely Braces": [[1, "parsing-lonely-braces"]], "References": [[1, "references"], [4, null]], "Glossary": [[3, "glossary"]], "Template Instantiator State Transition Rules": [[6, "template-instantiator-state-transition-rules"]], "Pairs": [[6, "pairs"]], "Lists": [[6, "lists"]], "The Template Instantiator": [[2, "the-template-instantiator"]], "Welcome to rlp\u2019s documentation!": [[4, "welcome-to-rlp-s-documentation"]], "Contents": [[4, "contents"]], "Index": [[4, null]], "Commentary": [[4, null]], "The G-Machine": [[0, "the-g-machine"]], "Motivation": [[0, "motivation"]], "Trees and Vines, in Theory": [[0, "trees-and-vines-in-theory"]], "Evaluation: Slurping Vines": [[0, "evaluation-slurping-vines"]], "Laziness": [[0, "laziness"]], "Compilation: Squashing Trees": [[0, "compilation-squashing-trees"]], "G-Machine State Transition Rules": [[5, "g-machine-state-transition-rules"]], "Core Transition Rules": [[5, "core-transition-rules"]], "Extension Rules": [[5, "extension-rules"]]}, "indexentries": {}})
\ No newline at end of file
+Search.setIndex({"docnames": ["commentary/gm", "commentary/layout-lexing", "commentary/ti", "glossary", "index", "references/gm-state-transitions", "references/ti-state-transitions"], "filenames": ["commentary/gm.rst", "commentary/layout-lexing.rst", "commentary/ti.rst", "glossary.rst", "index.rst", "references/gm-state-transitions.rst", "references/ti-state-transitions.rst"], "titles": ["The G-Machine", "Lexing, Parsing, and Layouts", "The Template Instantiator", "Glossary", "Welcome to rlp\u2019s documentation!", "G-Machine State Transition Rules", "Template Instantiator State Transition Rules"], "terms": {"index": 0, "modul": 1, "search": [], "page": [], "begin": [0, 1, 5, 6], "tblr": [], "ccclc": [], "hline": [], "": [0, 1, 3, 5, 6], "d": [0, 5, 6], "h": [0, 5, 6], "bmatrix": [0, 5, 6], "mathtt": [0, 5, 6], "nap": [5, 6], "a_1": [0, 5, 6], "a_2": [5, 6], "nind": [5, 6], "a_3": 6, "end": [0, 1, 5, 6], "f": [0, 1, 5, 6], "impli": [], "thi": [0, 1, 2, 5], "i": [0, 1, 3, 5, 6], "normal": [1, 6], "paragraph": [], "what": [], "follow": [1, 5], "precompil": [], "latex": [], "equat": [], "math": [], "transrul": [0, 6], "test": [], "The": [1, 3, 4, 5], "spineless": [], "tagless": [], "g": [1, 4, 6], "machin": [2, 4], "wip": [0, 2], "here": 1, "typeset": [], "state": [1, 2, 4], "transit": 4, "rule": [1, 4], "describ": 1, "action": 5, "dereferenc": [], "indirect": [5, 6], "when": [0, 1, 5, 6], "pass": [0, 6], "function": [1, 5, 6], "argument": [0, 5, 6], "derefer": 6, "an": [0, 1, 3, 5, 6], "top": [0, 1, 3, 5, 6], "stack": [0, 1, 5, 6], "p": 6, "negat": [], "form": [1, 6], "nprim": 6, "neg": 5, "x": [0, 1, 5, 6], "nnum": [5, 6], "n": [0, 1, 5, 6], "perform": 6, "unari": [5, 6], "oper": [1, 5, 6], "o": 6, "e": [0, 1, 5, 6], "intern": [1, 6], "prim": 6, "constructor": [5, 6], "unevalu": [], "b": 0, "nillist": [5, 6], "hopefulli": 2, "expand": 2, "thorough": 2, "explan": [], "evalu": [5, 6], "complet": [1, 5, 6], "singl": [0, 1, 6], "texttt": [], "remain": 6, "dump": [5, 6], "empti": [5, 6], "halt": [5, 6], "restor": [5, 6], "sub": 6, "comput": 6, "ha": [0, 1, 6], "reduc": [5, 6], "supercombin": [0, 1, 3, 5, 6], "updat": [0, 5, 6], "root": [0, 6], "beta": [5, 6], "a_0": [0, 5, 6], "ldot": [0, 5, 6], "a_n": [0, 5, 6], "nsupercomb": [0, 6], "x_1": [0, 6], "x_n": [0, 6], "text": [0, 1, 5, 6], "where": [0, 1, 5, 6], "instantiateu": [0, 6], "setcel": [0, 5, 6], "r": [], "2": [0, 1, 5], "c": [0, 1, 5, 6], "3": [0, 3, 6], "\u03b2": [], "caption": [], "figur": [], "gather": [], "tag": [], "1": [0, 1, 5, 6], "binari": [5, 6], "y": [1, 5, 6], "associ": [1, 6], "two": [1, 6], "both": [1, 6], "In": [1, 5, 6], "condit": [1, 6], "primit": [5, 6], "placehold": [], "walkthrough": 2, "textt": [], "ifp": 6, "reduct": [5, 6], "been": [5, 6], "true": 6, "conp": 6, "0": [0, 6], "mathbb": [], "fals": 6, "construct": 6, "ndata": 6, "out": [1, 6], "its": [0, 1, 5, 6], "t": [1, 5, 6], "vdot": [5, 6], "a_": [5, 6], "style": 1, "languag": 1, "my": 1, "previou": [1, 5], "experi": 1, "have": [1, 5], "all": 1, "had": 1, "quit": [0, 1], "trivial": 1, "lexic": [], "analysi": 1, "stage": 1, "peak": 1, "complex": 1, "stream": 1, "token": 1, "lazili": 1, "task": [0, 1], "tokenis": 1, "veri": [0, 1], "simpl": [0, 1, 3], "descript": 1, "you": 1, "ignor": 1, "whitespac": 1, "point": [1, 5], "recognis": 1, "If": [1, 5, 6], "don": 1, "someth": [0, 1], "check": 1, "liter": 1, "identifi": [1, 5], "should": 1, "neither": 1, "return": 1, "error": 1, "On": 1, "paper": 1, "haskel": 3, "like": [0, 1], "seem": 1, "pose": 1, "few": 1, "greater": 1, "challeng": 1, "some": 1, "potenti": 1, "roadblock": 1, "mind": 1, "befor": 1, "make": [1, 5], "attempt": 1, "were": 1, "sensit": 1, "while": [1, 5], "wa": [0, 1], "comfort": 1, "idea": [1, 3], "system": 1, "similar": 1, "python": [], "indent": 1, "dedent": 1, "us": [0, 1, 3], "section": [1, 3], "code": [0, 1, 3, 5], "wai": [0, 1], "felt": 1, "differ": 1, "onli": [0, 1], "user": 1, "defin": 1, "infix": 1, "preced": 1, "level": [1, 3], "recal": 1, "algorithm": 1, "look": 1, "up": [1, 5], "prefix": 1, "postfix": 1, "even": 1, "mixfix": 1, "global": [1, 5], "tabl": 1, "call": 1, "appropri": [1, 6], "parser": [0, 1], "also": [1, 5], "store": 1, "never": [1, 5], "modifi": [1, 5], "runtim": 1, "howev": 1, "could": 1, "nice": 1, "solut": [0, 1], "context": 1, "keyword": 1, "allow": [1, 3], "word": 1, "famili": 1, "role": 1, "from": [0, 1, 5], "_note": [], "found": [0, 1], "ghc": 1, "lexer": 1, "first": [1, 6], "ar": [0, 1, 5], "consid": [1, 5], "bodi": [0, 1], "relev": 1, "type": [0, 1], "declar": 1, "lex": 4, "pars": 4, "layout": [3, 4], "note": [1, 5], "list": 1, "ascend": 1, "intimid": 1, "factor": 1, "read": 1, "appear": 1, "which": [0, 1], "after": [1, 5], "case": [1, 3, 5], "els": 1, "express": [0, 1, 3], "etc": 1, "bit": 1, "thought": 1, "research": 1, "refer": [], "them": [1, 5], "easili": 1, "scariest": 1, "thing": 1, "thei": [0, 1], "achiev": 1, "we": [0, 1, 5], "compar": 1, "contrast": 1, "much": 1, "dismai": 1, "newlin": [1, 3], "separ": 1, "statement": 1, "resolv": 1, "scope": 1, "instead": [0, 1], "tradit": 1, "semicolon": 1, "brace": [], "see": 1, "bcpl": [], "http": [], "doc": [], "org": [], "lexical_analysi": [], "html": [], "dure": [0, 1], "new": [0, 1, 5], "line": 1, "appli": [0, 1, 5], "than": 1, "insert": 1, "push": [0, 1, 5], "onto": [0, 1, 5], "initialis": 1, "zero": [0, 1], "lesser": 1, "pop": [0, 1, 5], "until": 1, "each": 1, "equal": 1, "termin": 1, "leav": [1, 5], "ident": 1, "pretti": 1, "philosophi": 1, "one": 1, "correct": [1, 5], "answer": 1, "todo": [1, 3], "need": 1, "sourc": 1, "develop": 1, "our": [0, 1], "pattern": 1, "translat": 1, "explicitli": 1, "saw": 1, "most": [1, 3], "notabl": 1, "exampl": [1, 3], "implicitli": [1, 3], "why": 1, "am": 1, "so": [1, 5], "afraid": 1, "syntax": [1, 3], "A": 5, "primer": [], "But": [], "about": [], "mai": 1, "gener": 1, "To": 1, "frank": 1, "m": [1, 5], "far": 1, "less": 1, "scare": 1, "ask": 1, "myself": 1, "certainli": 1, "needn": 1, "concern": 1, "implicit": 1, "continu": [1, 5], "written": 1, "over": 1, "multipl": 1, "often": 1, "seen": 1, "somewhat": 1, "esoter": 1, "extrem": 1, "common": 1, "data": 1, "cry": 1, "right": 1, "now": 1, "sorri": 1, "anoth": 1, "format": 1, "odditi": 1, "anotherth": 1, "do": [0, 1], "align": [1, 3], "contiat": [], "enough": 1, "fear": 1, "let": 1, "actual": 1, "think": [1, 3], "implement": 1, "firstli": 1, "formal": 1, "mean": [0, 1, 5], "sai": 1, "order": [1, 5], "yield": 1, "thankfulli": 1, "u": [1, 3], "entri": 1, "clear": 1, "select": 1, "minor": 1, "except": 1, "elabor": 1, "being": [0, 1], "altern": [1, 3], "term": [1, 3], "link": 1, "glosarri": [], "cultur": 3, "infam": 3, "scari": 3, "mathemat": 3, "pleas": 3, "excus": 3, "realli": 3, "fun": 3, "glossari": [1, 4], "free": [1, 3], "variabl": [0, 3], "For": [1, 3], "purpos": 3, "just": [1, 3, 5], "definit": [1, 3], "possibl": [1, 3], "match": 3, "under": 1, "assumpt": [], "give": [], "lexem": 1, "next": 1, "file": [], "reach": 1, "henceforth": [], "denot": 1, "repres": 1, "subsequ": [], "column": 1, "number": [1, 5], "charact": 1, "must": [], "introduc": 1, "addit": [], "input": [], "handl": 1, "obvious": [], "would": 1, "requir": [1, 5], "string": 5, "help": [], "book": [], "keep": [0, 1], "tool": [], "good": [], "current": [1, 5], "cascad": 1, "element": 1, "either": 1, "nolayout": [], "indic": 0, "explicit": 1, "programm": [], "herself": [], "non": [0, 1], "integ": [], "enclos": 1, "rememb": [1, 5], "w": [0, 1], "10": [1, 5], "pure": [], "abov": [], "notic": 0, "accom": [], "langl": [1, 5], "rangl": [1, 5], "lastli": [], "compliment": [], "how": [1, 5], "close": 1, "preceed": 1, "provid": 5, "consequ": [], "ll": 1, "more": 1, "pedant": 1, "chapter": 1, "2010": 1, "report": 1, "heavili": 1, "referenc": 1, "manag": 1, "record": 1, "laid": 1, "start": 1, "item": 1, "belong": 1, "With": 1, "plai": 1, "set": [1, 5], "inform": 1, "otherwis": 1, "adequet": 1, "satisfi": 1, "basic": 1, "contin": 1, "varnoth": 1, "final": 1, "concept": 1, "virtual": 1, "re": 1, "moment": [0, 1], "exactli": 1, "compil": 1, "present": 1, "small": 1, "addition": 1, "open": 1, "observ": 1, "sampl": 1, "can": 1, "bind": [0, 1], "rather": 1, "focu": 1, "na\u00efv": 1, "eol": 1, "prove": 1, "unid": 1, "wait": 1, "comparison": 1, "nondescript": 1, "measur": 1, "numer": 1, "valu": [1, 5], "offsid": 1, "formalis": 1, "graphem": 1, "resid": 1, "exist": [0, 1, 5], "assum": 1, "print": 1, "delimit": 1, "last": 1, "distinct": 1, "between": 1, "come": 1, "partial": 1, "toward": 1, "respons": 1, "share": [1, 5], "content": 1, "same": 1, "shall": 1, "cover": 1, "includ": 1, "framework": 1, "time": [0, 1], "cannot": 1, "model": [0, 1], "simpli": [0, 1], "As": 1, "long": 1, "track": 1, "own": 1, "cope": 1, "fine": 1, "without": 1, "view": 1, "abstract": 1, "yet": 1, "decompos": 1, "discret": 1, "typic": 1, "linear": [0, 1], "recurs": 1, "down": 1, "big": 1, "reason": 1, "aim": 1, "tend": 1, "burden": 1, "necessari": [1, 6], "still": 1, "natur": 1, "orient": 1, "backtrack": 1, "difficult": 1, "ineleg": 1, "counterintuit": 1, "eleg": 1, "problem": 1, "minimis": 1, "rlp": [1, 3], "bnf": 1, "setlength": [], "grammarparsep": [], "20pt": [], "plu": [], "1pt": [], "minu": [], "grammarind": [], "12em": [], "grammar": [], "expr": [0, 1], "alt": [], "stat": [], "vopen": 1, "vclose": 1, "recov": 1, "treat": 1, "ensur": 1, "casepairp": 6, "_": 6, "scrutine": 6, "caselistp": 6, "nil": 6, "f_": 6, "con": 6, "initi": 0, "templat": [0, 4], "instanti": [0, 4, 5], "tim": [], "straightforward": 0, "core": 0, "design": 0, "major": 0, "achil": 0, "heel": 0, "interleav": 0, "heap": [0, 5], "node": [0, 5], "hold": 0, "uninstanti": 0, "raw": 0, "ast": 0, "straight": 0, "spot": 0, "lead": [], "loss": [], "travers": 0, "tree": [], "difficulti": [], "lower": [], "investig": [], "scstep": 0, "name": [0, 5], "tistat": 0, "st": 0, "rootaddr": 0, "drop": 0, "length": 0, "env": 0, "argbind": 0, "zip": 0, "argaddr": 0, "getarg": 0, "src": 0, "hello": [], "world": [], "process": 0, "goe": 0, "augment": 0, "environ": [0, 5], "local": 0, "remov": 0, "address": [0, 5], "newli": [0, 5], "4": 0, "structur": 0, "unfit": 0, "assembli": 0, "target": 0, "goal": 0, "sequenc": 0, "instruct": [0, 5], "execut": 0, "lookup": 5, "gmrule": 5, "pushglob": 5, "alloc": 5, "int": [0, 5], "creat": 5, "pushint": 5, "applic": 5, "directli": 5, "below": 5, "mkap": [0, 5], "_n": [], "tidi": 5, "slide": [0, 5], "unwind": [0, 5], "jump": 5, "nglobal": 5, "compiledsc": 0, "compilesc": 0, "scdef": 0, "gm": 0, "run": 0, "map": [0, 5], "enumer": 0, "Of": 0, "cours": 0, "rel": 0, "becom": 0, "inaccur": 0, "around": 0, "offset": 0, "compilec": 0, "app": 0, "argoffset": 0, "sneaki": 5, "trick": 5, "enabl": 5, "object": [], "digit": 5, "valid": 5, "abus": 5, "ad": [], "base": 5, "rep": 5, "5": 5, "effect": 5, "take": 5, "alreadi": 5, "impact": 5, "garbag": 5, "collect": 5, "intend": 5, "might": 5, "e_n": 5, "nth": 5, "ti": 0, "e_1": 5, "uninitialis": 5, "space": 5, "nuninitialis": 5, "whnf": 5, "eval": 5, "z": [], "plain": 5, "old": 5, "put": 5, "conflict": 5, "discard": [], "queue": 5, "buld": 5, "k": 5, "unappli": 5, "again": 5, "build": 5, "pack": 5, "suffici": 5, "nconstr": 5, "casejump": 5, "v": 5, "concat": 5}, "objects": {}, "objtypes": {}, "objnames": {}, "titleterms": {"welcom": 4, "rlp": 4, "": 4, "document": 4, "indic": [], "tabl": [], "test": [], "page": [], "commentari": 4, "content": 4, "The": [0, 2], "spineless": [], "tagless": [], "g": [0, 5], "machin": [0, 5], "lex": 1, "pars": 1, "layout": 1, "rule": [5, 6], "refer": [1, 4], "A": 1, "lexic": 1, "primer": 1, "python": 1, "But": 1, "what": 1, "about": 1, "haskel": 1, "glossari": 3, "index": 4, "lone": 1, "brace": 1, "pair": 6, "list": 6, "templat": [2, 6], "instanti": [2, 6], "motiv": 0, "implement": [], "compil": 0, "how": [], "squash": 0, "tree": 0, "vine": 0, "theori": 0, "core": 5, "transit": [5, 6], "evalu": 0, "slurp": 0, "extens": 5, "lazi": 0, "state": [5, 6], "ti": []}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 60}, "alltitles": {"The G-Machine": [[0, "the-g-machine"]], "Motivation": [[0, "motivation"]], "Trees and Vines, in Theory": [[0, "trees-and-vines-in-theory"]], "Evaluation: Slurping Vines": [[0, "evaluation-slurping-vines"]], "Laziness": [[0, "laziness"]], "Compilation: Squashing Trees": [[0, "compilation-squashing-trees"]], "Lexing, Parsing, and Layouts": [[1, "lexing-parsing-and-layouts"]], "A Lexical Primer: Python": [[1, "a-lexical-primer-python"]], "But What About Haskell?": [[1, "but-what-about-haskell"]], "Parsing Lonely Braces": [[1, "parsing-lonely-braces"]], "References": [[1, "references"], [4, null]], "The Template Instantiator": [[2, "the-template-instantiator"]], "Glossary": [[3, "glossary"]], "Welcome to rlp\u2019s documentation!": [[4, "welcome-to-rlp-s-documentation"]], "Contents": [[4, "contents"]], "Index": [[4, null]], "Commentary": [[4, null]], "Template Instantiator State Transition Rules": [[6, "template-instantiator-state-transition-rules"]], "Pairs": [[6, "pairs"]], "Lists": [[6, "lists"]], "G-Machine State Transition Rules": [[5, "g-machine-state-transition-rules"]], "Core Transition Rules": [[5, "core-transition-rules"]], "Extension Rules": [[5, "extension-rules"]]}, "indexentries": {"case alternative": [[3, "term-case-alternative"]], "layout": [[3, "term-layout"]], "supercombinator": [[3, "term-supercombinator"]]}})
\ No newline at end of file
diff --git a/doc/src/conf.py b/doc/src/conf.py
index 7fac303..1cd64cc 100644
--- a/doc/src/conf.py
+++ b/doc/src/conf.py
@@ -50,6 +50,8 @@ imgmath_latex_preamble = r'''
\end{tblr} }
\newcommand{\nillist}{[\,]}
+
+\newcommand{\concat}{+\kern-1.3ex+\kern0.8ex}
'''
imgmath_image_format = 'svg'
diff --git a/doc/src/references/gm-state-transitions.rst b/doc/src/references/gm-state-transitions.rst
index e44c909..1c452f0 100644
--- a/doc/src/references/gm-state-transitions.rst
+++ b/doc/src/references/gm-state-transitions.rst
@@ -363,6 +363,47 @@ Core Transition Rules
& m
}
+#. Pack a constructor if there are sufficient arguments
+
+ .. math::
+ \gmrule
+ { \mathtt{Pack} \; t \; n : i
+ & a_1 : \ldots : a_n : s
+ & d
+ & h
+ & m
+ }
+ { i
+ & a : s
+ & d
+ & h
+ \begin{bmatrix}
+ a : \mathtt{NConstr} \; t \; [a_1,\ldots,a_n]
+ \end{bmatrix}
+ & m
+ }
+
+#. Evaluate a case
+
+ .. math::
+ \gmrule
+ { \mathtt{CaseJump} \begin{bmatrix} t \to c \end{bmatrix} : i
+ & a : s
+ & d
+ & h
+ \begin{bmatrix}
+ a : \mathtt{NConstr} \; t \; v
+ \end{bmatrix}
+ & m
+ }
+ { c \concat i
+ & d
+ & h
+ & m
+ }
+
+
+
***************
Extension Rules
***************
diff --git a/src/Control/Monad/Errorful.hs b/src/Control/Monad/Errorful.hs
index 4aa2d43..bcfd4a3 100644
--- a/src/Control/Monad/Errorful.hs
+++ b/src/Control/Monad/Errorful.hs
@@ -11,7 +11,6 @@ module Control.Monad.Errorful
where
----------------------------------------------------------------------------------
import Control.Monad.Trans
-import Control.Monad.Except
import Data.Functor.Identity
import Data.Coerce
import Lens.Micro
diff --git a/src/GM.hs b/src/GM.hs
index 28bb6f6..56933ad 100644
--- a/src/GM.hs
+++ b/src/GM.hs
@@ -55,11 +55,10 @@ data Instr = Unwind
| Alloc Int
| Eval
-- primitive ops
- | Neg
- | Add
- | Sub
- | Mul
- | Div
+ | Neg | Add | Sub | Mul | Div
+ | Pack Int Int -- Pack Tag Arity
+ | CaseJump [(Int, Code)]
+ | Split Int
deriving (Show, Eq)
data Node = NNum Int
@@ -70,6 +69,7 @@ data Node = NNum Int
| NGlobal Int Code
| NInd Addr
| NUninitialised
+ | NConstr Int [Addr] -- NConstr Tag Components
deriving (Show, Eq)
data Stats = Stats
@@ -707,5 +707,9 @@ showCode c = "Code" <+> braces instrs
where instrs = vcat $ showInstr <$> c
showInstr :: Instr -> Doc
+showInstr (CaseJump alts) = "CaseJump" $$ nest pprTabstop alternatives
+ where
+ showAlt (t,c) = "<" <> int t <> ">" <> showCodeShort c
+ alternatives = foldr (\a acc -> showAlt a $$ acc) mempty alts
showInstr i = text $ show i