Skip to content

Instantly share code, notes, and snippets.

View jlouis's full-sized avatar

Jesper Louis Andersen jlouis

View GitHub Profile
val a = [1.0, 2.0]
val b = [1.0, 2.0]
val _ = if a = b then print "True\n"
else print "False\n"
---
jlouis@succubus:~$ mosml z.sml
Moscow ML version 2.01 (January 2004)
Enter `quit();' to quit.
% Core Mini-ML
% --- syntax
exp : type.
z : exp.
s : exp -> exp.
case : exp -> exp -> (exp -> exp) -> exp.
lam : (exp -> exp) -> exp.
app : exp -> exp -> exp.
% Jesper Louis Andersen
% Core Mini-ML + Lists definitions
% Syntax extensions
nil : exp.
cons : exp -> exp -> exp.
lcase : exp -> exp -> (exp -> exp -> exp) -> exp.
% Evaluation extensions
% Jesper Louis Andersen
% This is a proof of value soundness of miniml+lists
vs : %{{E:exp} {V:exp}}% eval E V -> value V -> type.
%mode vs +EP -VP.
vs_z : vs ev_z val_z.
vs_s : vs (ev_s EP) (val_s VP)
<- vs EP VP.
%% TAL Prelude.
%% Jesper Louis Andersen 2009.
%{
This defines the prelude of the TAL project. In here, we define a basis in the
same vein as the Haskell prelude or the Standard ML pervasives: A helper set of
commonly used constructions.
}%
@jlouis
jlouis / MSM.hs
Created September 17, 2009 23:20
module MSM where
import Control.Monad.State
import Instructions
import Data.Array
-- MSMachine - The record for the state machine. This contains our 2 Int registers, the Int stack, and our PC.
data MSMachine = MSMachine {
stack :: [Int],
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
from pylons.decorators.rest import restrict
from gimoas.lib.base import BaseController, render
import gimoas.lib.helpers as h
%%% The absurd statement. A tool for reasoning from false.
%%% Jesper Louis Andersen 2008
void : type. %name void _|_.
%freeze void.
%%% Booleans
%%% Jesper Louis Andersen
% ===== The Boolean type =====
bool : type.
%{ Small playtoy language for
working with function calls
TODO: add F and Gamma!
}%
%{ ** SYNTAX ** }%
nat : type.
val tri = List.rev
["75",
"95 64",
"17 47 82",
"18 35 87 10",
"20 04 82 47 65",
"19 01 23 75 03 34",
"88 02 77 73 07 63 67",
"99 65 04 28 06 16 70 92",
"41 41 26 56 83 40 80 70 33",