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
#!/usr/bin/python3 | |
import mailbox | |
import sys | |
import os | |
def main(): | |
argv = sys.argv | |
if len(argv) != 2: | |
print(f'Usage: {argv[0]} <mbx file>') |
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
// Library for ELVM's C++ Template Metaprogramming backend | |
// Input Buffer | |
constexpr static const char* input = | |
# include "input.txt" | |
; | |
// Memory Size | |
const int MEM_SIZE = 1 << 16; |
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
# 出典: https://github.com/shinh/elvm/blob/master/test/05regjmp.eir | |
mov A, l | |
jmp A | |
putc 78 | |
exit | |
l: | |
putc 89 | |
exit |
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
# 出典: https://github.com/shinh/elvm/blob/master/test/06mem.eir | |
# "MEM" と出力される | |
mov B, 77 | |
store B, 300 | |
load A, 300 | |
load A, 300 | |
putc A | |
mov B, 69 | |
store B, 30 | |
store B, 30 |
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 java.math.BigInteger; | |
public class Bench { | |
private final static long MOD = 1000000007; | |
public static long fib(long n) { | |
if (n <= 1) { | |
return 1; | |
} else { | |
return fib(n - 1) + fib(n - 2); | |
} |
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
#!/usr/bin/python | |
import shutil | |
shutil.copyfile("./main.tex", "all.tex") | |
flg = True | |
while flg: | |
flg = False | |
out = [] | |
with open("all.tex", "r") as f: |
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
let rec fix f x = f (fix f) x;; | |
(* hungry function *) | |
(* iso-recursive *) | |
type iso_hungry = Hungry of (int -> iso_hungry);; | |
let iso_hungryfun = Hungry (fix (fun f n-> Hungry f));; | |
(* equi-recursive *) | |
#rectypes;; |
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
(* ones = (1,(1,(1,...)))*) | |
(* iso-recursive *) | |
type 'a infTuple = InfTuple of ('a * 'a infTuple);; | |
let rec iso_ones = InfTuple(1, iso_ones);; | |
(* equi-recursive *) | |
#rectypes;; | |
let rec equi_ones : (int * 'a) as 'a = (1, equi_ones);; |
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
# If you execute `make run`, xv6 will be compiled by UCC and boot up in the simulator. | |
# You need OCaml and clang to compile UCC. | |
all: ucc xv6 | |
ucc: | |
git clone git@github.com:kw-udon/ucc.git | |
make -C ./ucc/ | |
xv6: |