Skip to content

Instantly share code, notes, and snippets.

View objmagic's full-sized avatar

R Li objmagic

View GitHub Profile
@objmagic
objmagic / functor.ml
Last active August 29, 2015 14:25
failed..
module type X = sig
type t
end
module type SS = sig
type t
end
module F (S: SS) : X with type t = S.t = struct
include S
@objmagic
objmagic / gadt-escape.ml
Last active August 29, 2015 14:24
escape
type _ grammar =
| Either : 'a grammar list -> 'a grammar
| CharLiteral : char -> char grammar
type state
type 'a result = Ok of 'a | Failure of string
type 'a parser_code = state code -> 'a result code
type _ cgrammar =
| Lit : elem -> elem cgrammar
| Seq : 'a cgrammar * 'b cgrammar -> ('a * 'b) cgrammar
| Left : 'a cgrammar * 'b cgrammar -> 'a cgrammar
| Right : 'a cgrammar * 'b cgrammar -> 'b cgrammar
| Either : 'a cgrammar list -> 'a cgrammar
| Rep : 'a cgrammar -> ('a list) cgrammar
| Repsep : 'a cgrammar * 'b cgrammar -> ('a list) cgrammar
| TakeWhile : ('a -> bool) -> ('a list) cgrammar
| Trans : ('a -> 'b) * 'a cgrammar -> 'b cgrammar
.<
fun state_23 ->
let res1_24 =
(fun state_13 ->
let res1_14 =
(fun state_1 ->
let ix_2 = state_1.Nparser.Char_parser.index in
let f_3 = Nparser.Char_parser.Failure state_1 in
if ix_2 < state_1.Nparser.Char_parser.length
then
@objmagic
objmagic / Makefile
Created June 29, 2015 15:26
unbound
#
# Build system for ocs library and interpreter
#
OCAMLBUILD = ocamlbuild
METAOCAMLC = metaocamlc
build:
$(OCAMLBUILD) -classic-display -ocamlc $(METAOCAMLC) a.byte b.byte
@objmagic
objmagic / .merlin
Created June 27, 2015 11:10
merlin
B _build/**
S .
EXT meta
FastParser {
def rule1:Parser[(Char,Char)] = 'a' ~ 'b'
def rule2 = ('a' | 'b') ~ 'c'
def rule3 = ('a' ~ 'b') | 'c'
def rule4 = rule1 ~ (rule2 | rule3) ~ rule1
def rule5 = ('a' | 'b').rep(2,5)
}
/* --------------------------------------------------------- */
@objmagic
objmagic / functor_autocomplete.ml
Last active August 29, 2015 14:21
Merlin does auto complete this
(* can be compiled with $corebuild functor_autocomplete.native *)
open Core_kernel.Std
module Key : Map.Key = struct
type t = int list with sexp
let compare (l1:t) (l2:t) : int =
if Set.equal
(Set.of_list ~comparator:Int.comparator l1)
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:16:52 05/19/2015
// Design Name:
// Module Name: Square
// Project Name:
// Target Devices:
module Cars_in_a_row {
input wire clk,
output [9:0] width, // width, spacing and pos
output [9:0] spacing,
output [9:0] posy
};
reg [9:0] posy_ = 0;
reg [9:0] spacing_ = 300;
reg [9:0] width_ = 200;