Skip to content

Instantly share code, notes, and snippets.

View woodrush's full-sized avatar

Hikaru Ikuta woodrush

View GitHub Profile
@woodrush
woodrush / grass.ml
Last active October 12, 2022 20:23 — forked from youz/grass.ml
ocaml implementation of http://www.blue.sky.or.jp/grass/
(* Original implementation by @ytomino: https://gist.github.com/ytomino/1113165 *)
(* Forked by @youz: https://gist.github.com/youz/99d41967e08b8dde8a9199efdb36bee0 *)
(* Forked again by @woodrush: https://gist.github.com/woodrush/3d85a6569ef3c85b63bfaf9211881af6 *)
type token = T_w | T_W | T_v | EOF;;
let rec scan s i = (
let length = String.length s in
if i >= length then length, EOF else
match s.[i] with
| 'W' -> i + 1, T_W