Skip to content

Instantly share code, notes, and snippets.

Neel Krishnaswami neel-krishnaswami

Block or report user

Report or block neel-krishnaswami

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@neel-krishnaswami
neel-krishnaswami / abt
Last active Aug 22, 2019
Abstract binding trees implementation
View abt
(* -*- mode: ocaml; -*- *)
module type FUNCTOR = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
end
type 'a monoid = {unit : 'a ; join : 'a -> 'a -> 'a}
type var = string
View spreadsheet.mli
module type CELL = sig
type 'a cell
type 'a exp
val return : 'a -> 'a exp
val (>>=) : 'a exp -> ('a -> 'b exp) -> 'b exp
val cell : 'a exp -> 'a cell exp
val get : 'a cell -> 'a exp
@neel-krishnaswami
neel-krishnaswami / re.ml
Created Nov 7, 2013
Implementation of DFA-based regexp matching using Antimirov derviatives
View re.ml
type re = C of char | Nil | Seq of re * re | Bot | Alt of re * re | Star of re
let rec null = function
| C _ | Bot -> false
| Nil | Star _ -> true
| Alt(r1, r2) -> null r1 || null r2
| Seq(r1, r2) -> null r1 && null r2
module R = Set.Make(struct type t = re let compare = compare end)
let rmap f rs = R.fold (fun r -> R.add (f r)) rs R.empty
@neel-krishnaswami
neel-krishnaswami / parsing.ml
Created Apr 20, 2017
Typed algebraic parsing
View parsing.ml
(* Types *)
module C = Set.Make(Char)
type tp = { null : bool; first : C.t; follow : C.t }
(* Grammars *)
type t =
| Var of string
| Fix of string * tp * t
| Eps
| Char of char
View frp.mli
(* -*- mode: ocaml; -*- *)
module type NEXT =
sig
type 'a t
exception Timing_error of int * int
val delay : (unit -> 'a) -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val zip : 'a t * 'b t -> ('a * 'b) t
You can’t perform that action at this time.