Skip to content

philomates/derpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a derivative based lexer and parser for a subset of Python3.

More info on parsing with derivatives: http://matt.might.net/articles/parsing-with-derivatives/

This software was for a project from Spring11 Compilers at the University of Utah. Further details on the project: http://matt.might.net/teaching/compilers/spring-2011/#projects

Note:
  This is my first piece of Haskell software. No guarantees on good style or code correctness.

  The lexer currently doesn't handle carriages (\r style newlines)

Building:
  Cabal build system (Haskell's build system)
  GHC >= 7.0.1
  Text.Derp package for Haskell

  install cabal on your system
  run the following commands:
    cabal install derp
    cabal install 'base >= 4.3'

Running:
  # compile
  cabal configure
  cabal build

  # run lexer
  make lex < tests/test_lexer/1.py

  # run parser
  make parse < tests/1.py

  # run parser test suite
  make test

  # run lexer test suite
  make test_lexer


Manifest:
  - README: you are here
  - Makefile: for running cabal commands and running lexer & parser. Adheres to makefile structure defined in assignment
  - pyparser.cabal: cabal build file, like Makefile for the Haskell build system
  - Setup.hs: Basic setup file for cabal build
  - src/Main.hs: Entry point for parser
  - src/LexerMain.hs: Entry point for lexer
  - src/DerRegex.hs: David Darais' Derivative Regular Expression Library
  - src/LexerRegex.hs: Regular Expressions definitions for lexer
  - src/PythonLexer.hs: Improved lexer from assignment 1
  - src/PythonParser.hs: Parser
  - tests/: parser tests
  - tests/test_lexer/: lexer tests

About

Python3 lexing and parsing with derivatives

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published