Skip to content

Instantly share code, notes, and snippets.

View adjustments.diff
diff --git a/src/gText.mli b/src/gText.mli
index 455b90b3..a29f8d07 100644
--- a/src/gText.mli
+++ b/src/gText.mli
@@ -491,14 +491,12 @@ object ('a)
method populate_popup :
callback:(menu obj -> unit) -> GtkSignal.id
method set_anchor : callback:(unit -> unit) -> GtkSignal.id
- method set_scroll_adjustments :
- callback:(GData.adjustment option -> GData.adjustment option -> unit)
@vrotaru
vrotaru / graph.ml
Created Nov 28, 2017
Updated example from OCaml GTK tutorial
View graph.ml
open GObj
(* Draw text left, centre or right justified at point. (x,y) point is
* either top left, top middle or top right of text.
*)
let draw_text drawable font_description position (x, y) text : unit =
let context = Gdk.Screen.get_pango_context () in
let layout = Pango.Layout.create context in
let () = Pango.Layout.set_font_description layout font_description in
let () = Pango.Layout.set_text layout text in
View keybase.md

Keybase proof

I hereby claim:

  • I am vrotaru on github.
  • I am vrotaru (https://keybase.io/vrotaru) on keybase.
  • I have a public key ASAuaOcLxLWR2FtMDOTotdYXZxyxrpTdPKm-Pi3uiTavOAo

To claim this, I am signing this object:

View Unapply.scala
trait A
case object a extends A
case object b extends A
trait B
case object x extends B
case object y extends B
View assert.html
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Easy JavaScript Testing></title>
<style>
.pass:before {
content: 'PASS: ';
color: blue;
font-weight: bold;
View urpass.sh
#! /bin/bash
SRC=/dev/urandom
len=${1-12}
i=1
while (( $i <= len )); do
if (( ($i + 1) % 3 == 0 )) ; then
cat $SRC | base64 | tr -dc aeiouy | head -c1
View split_to_ints.ml
let char_0 = Char.code '0'
let split n s =
let len_s = String.length s in
let res = Array.make n 0 in
let rec slide pos =
if pos < len_s && s.[pos] <> ' ' then
pos + 1 |> slide
else pos
View README.md

The goal of this exercise it to have a minimal parser which will parse expressions as the ML languages do. Namely to have function application to have the highest priority. The key to this seems to have a minimal set of productions in the base rule. The app rule defines that application groups to the left.

The type expr from Syntax module has the following interpretation: Int-s are numbers, Fn-s are predefined function names and App and Plus have the obvious and natural meaning.

A way to test it is to run mehnir --interpret --interpret-show-cst parser.mly

View gadt.ml
type _ ty =
| TBool : bool ty
| TInt : int ty
type _ value =
| Bool : bool -> bool value
| Int : int -> int value
type _ expr =
| Value : 'a value -> 'a expr
View gadt_any.ml
type _ ty =
| TBool : bool ty
| TInt : int ty
type _ value =
| Bool : bool -> bool value
| Int : int -> int value
type _ expr =
| Value : 'a value -> 'a expr