Skip to content

Instantly share code, notes, and snippets.

@rcoh
Created August 18, 2014 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcoh/aa52a6a30ca3e618cc9c to your computer and use it in GitHub Desktop.
Save rcoh/aa52a6a30ca3e618cc9c to your computer and use it in GitHub Desktop.
blog1.scala
abstract class RegexExpr
// ., a, b
case class Literal(c: Char) extends RegexExpr
// a|b
case class Or(expr1: RegexExpr, expr2: RegexExpr) extends RegexExpr
// ab -> Concat(a,b); abc -> Concat(a, Concat(b, c))
case class Concat(first: RegexExpr, second: RegexExpr) extends RegexExpr
// a*
case class Repeat(expr: RegexExpr) extends RegexExpr
// a+
case class Plus(expr: RegexExpr) extends RegexExpr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment