Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import os, sys
import subprocess
import readline
from collections import defaultdict
TABSIZE = 2
class TaskDefDict(defaultdict):
def __missing__(self, key):
object BalancedParens {
// some convenient shorthand
def sym(c: Char) = new Symbol[Char](c)
val alnum = new AlphaNumeric()
def many[T: Manifest](p: Parser[Char, T]) = new Many(p)
def option[T, U](l: Parser[Char, T], r: Parser[Char, U]) = new Option(l, r)
val nothing: Parser[Char, Unit] = new Wrapper(())
// our parser; matches expressions of the form (*x)* where the # of parens