/cs577-pattern-matching-compiler

CS 577 Final Project: Pattern Matching Compiler

Primary LanguageHaskell

Synopsis

A pattern matching compiler for CS 557 final project.

Running

Install stack, then run stack ghci to launch ghci. Run function drive to explore the examples.

drive parses the type and patterns from examples/1.hs, compiles the last pattern, and writes to 1.dot.

Modules

  • ADT defines the types in the language.
  • Backtrack implements the backtracking automata compilation scheme, using Try nodes to handle backtracking.
  • Backtrack2 implements the backtracking automata compilation scheme, using explicit jumps to handle backtracking.
  • CompileUtils contains the shared types and functions for all the compilation schemes.
  • DecisionTree implements the decision tree compilation scheme.
  • DecisionTreeOpt implements several optimizations that's can be applied to the code generated by the decision tree scheme.
  • Driver contains example code to parse and compile files.
  • Eval contains the semantics for the pattern language and the compiled code.
  • Naive implements a naive (top-to-down, left-to-right) compilation scheme.
  • Pat defines the patterns in the language.
  • Syntax contains a Parsec-based parser for the language.
  • Visualize renders generated flow graphs into Dot files.