This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| P-code for PL/0 machine | |
| [ref] https://en.wikipedia.org/wiki/P-code_machine | |
| [ref] http://blackmesatech.com/2011/12/pl0/pl0.xhtml | |
| The PL/0 virtual machine was originally specified by Nicklaus Wirth in his book | |
| Algorithms + Data Structures = Programs; it's used as the target machine for a | |
| PL/0 compiler. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| * An OCaml implementation of final tagless, inspired from this article by Oleksandr Manzyuk: | |
| * https://oleksandrmanzyuk.wordpress.com/2014/06/18/from-object-algebras-to-finally-tagless-interpreters-2/ | |
| *) | |
| module FinalTagless = struct | |
| type eval = { eval : int } | |
| type view = { view : string } | |
| module type ExpT = sig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module AVL = struct | |
| type height = int | |
| type int = height | |
| module Elt = Int32 | |
| type t = Leaf | Node of t * Elt.t * t * height | |
| exception Impossible | |
| let height = function |