Skip to content

Instantly share code, notes, and snippets.

View bitmappergit's full-sized avatar

Bram Wyllie bitmappergit

View GitHub Profile
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <gc.h>
typedef enum {
APP,
COMB,
} tag_t;
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <mimalloc.h>
#include <libdill.h>
typedef enum {
APP,
COMB,
} tag_t;
% --------------------------------------
:- op(500, fx, pi).
:- op(500, fx, lam).
:- op(600, xfy, =>).
:- op(650, xfx, :).
:- op(625, xfy, $).
% --------------------------------------
open import Data.String
open import IO
data Term : Set where
I : Term
Z : Term
_$_ : Term → Term → Term
infixl 25 _$_
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
@bitmappergit
bitmappergit / ski.c
Last active December 21, 2020 17:26
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <gc.h>
typedef enum {
APP,
COMB,
} tag_t;
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
vname == [char]
vexp ::=
Var vname
| Lambda vname vexp
| Ap vexp vexp
| Let [vname] [vexp] vexp
| Letrec [vname] [vexp] vexp
tvname == [num]
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)
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 '#'