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
{-# LANGUAGE GADTs, FlexibleContexts #-} | |
module CPSTrans where | |
import Control.Monad | |
import Control.Monad.Identity | |
import Control.Monad.State | |
import Control.Applicative hiding (Const) | |
data Expr where |
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
AOUT = parser | |
ifeq ($(findstring $(OS), Windows_NT), Windows_NT) | |
export EXE := .exe | |
unam := $(shell uname 2>&1) | |
HOST_OS := unknown | |
ifeq ($(findstring MINGW, $(unam)), MINGW) | |
HOST_OS := mingw |
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
#include<cstdio> | |
#include<map> | |
#include<string> | |
#include<functional> | |
#include<stdexcept> | |
#include<memory> | |
using std::map; | |
using std::string; | |
using std::function; |
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 Main | |
(>>) : Monad m => m a -> m b -> m b | |
(>>) m1 m2 = m1 >>= \_ => m2 | |
data Fmt : Type where | |
FmtInt : Fmt | |
FmtDbl : Fmt | |
FmtStr : Fmt | |
FmtIgn : (x : Char) -> Fmt |
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
____ __ _ | |
/ _/___/ /____(_)____ | |
/ // __ / ___/ / ___/ Version 0.9.10.1 | |
_/ // /_/ / / / (__ ) http://www.idris-lang.org/ | |
/___/\__,_/_/ /_/____/ Type :? for help | |
Idris> :dynamic msvcrt.dll | |
0?!D)brary: invalid argument (~ | |
Idris> :dynamic msvcrt | |
Idris> |
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
(load "match-case-simple.ss") | |
(define operators '(+ - * /)) | |
(define fresh | |
(let ([cnt 0]) | |
(lambda (s) | |
(set! cnt (+ cnt 1)) | |
(string->symbol (string-append s (number->string cnt)))))) |
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 Test | |
ap1 : (a, b : Type) -> (a -> b) -> a -> b | |
ap1 a b f x = f (apply id x) | |
where apply : (b -> b) -> b -> b | |
apply g y = g (g (g y)) | |
ap2 : (a, b : Type) -> (a -> b) -> a -> b | |
ap2 a b f x = f (apply id x) | |
where apply : (a -> a) -> a -> a |
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
global _start | |
[BITS 32] | |
_start: | |
mov ecx, 20000000 | |
call _func | |
_func: | |
pop eax | |
sub esp, 4 | |
dec ecx | |
jz .exit |
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
global _start | |
[BITS 32] | |
_start: | |
mov ecx, 10000000 | |
_loop: | |
call _func | |
loop _loop | |
finish: | |
xor eax,eax | |
xor ebx,ebx |
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
global _start | |
[BITS 32] | |
_start: | |
xor eax,eax | |
call _func | |
mov ecx, 200 | |
_loop: | |
mov eax, 100000 | |
call _func | |
loop _loop |