This file contains 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
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <gc.h> | |
typedef enum { | |
APP, | |
COMB, | |
} tag_t; |
This file contains 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
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <mimalloc.h> | |
#include <libdill.h> | |
typedef enum { | |
APP, | |
COMB, | |
} tag_t; |
This file contains 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
% -------------------------------------- | |
:- op(500, fx, pi). | |
:- op(500, fx, lam). | |
:- op(600, xfy, =>). | |
:- op(650, xfx, :). | |
:- op(625, xfy, $). | |
% -------------------------------------- |
This file contains 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
open import Data.String | |
open import IO | |
data Term : Set where | |
I : Term | |
Z : Term | |
_$_ : Term → Term → Term | |
infixl 25 _$_ |
This file contains 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
open import Data.String hiding (show) | |
open import Data.Nat | |
open import Data.Nat.Show | |
open import IO | |
data Term : Set where | |
S : Term | |
K : Term | |
I : Term | |
U : Term |
This file contains 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
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <gc.h> | |
typedef enum { | |
APP, | |
COMB, | |
} tag_t; |
This file contains 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
fun evac (n : int) : int = | |
let val r = ref 0 | |
val _ = if not (n >= 128) then r := n else () | |
val x = ref (load n) | |
val _ = while (!x >= 128 andalso load (!x) = 84) do | |
( store n (load (n + 1)) | |
; store (n + 1) (load (!x + 1)) | |
; x := load n | |
) | |
val _ = if !x >= 128 andalso load (!x) = 75 |
This file contains 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
vname == [char] | |
vexp ::= | |
Var vname | |
| Lambda vname vexp | |
| Ap vexp vexp | |
| Let [vname] [vexp] vexp | |
| Letrec [vname] [vexp] vexp | |
tvname == [num] |
This file contains 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
import qualified Data.Vector as DV | |
import qualified Data.HashMap.Lazy as DHM | |
import Data.Char | |
import Data.Ix | |
import Text.Parsec | |
import Text.Parsec.String | |
import Text.Read | |
type Input = DV.Vector (DHM.HashMap String String) |
This file contains 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
import Data.Char | |
import Data.Ix | |
import Text.Parsec | |
import Text.Parsec.String | |
import Text.Read | |
parseRow :: Parser [[(String, String)]] | |
parseRow = sepBy1 (many1 parser) $ space <|> newline | |
where | |
validChar = alphaNum <|> char '#' |