My code can be found here: https://bitbucket.org/ashley_dunn/compilers-project-2
I spoke with my professor about how I can go about tackling the parser and he said there are two primary paths I can take. First, I could write my own parser by hand (not recommended) utilizing the fact that Python has an LL(1) grammar and can be parsed with a recursive descent parser. Second I could use a derivative-based parser tool.
As usual, I'm starting out by doing some research. Here are a few of the sources I'm going to check out.
Option 1 (hand-written parser):
- http://en.wikipedia.org/wiki/LL_parser
- http://en.wikipedia.org/wiki/Recursive_descent_parser
- http://docs.python.org/2/library/parser.html
- http://docs.python.org/3/reference/grammar.html
Option 2 (derivative-based parsing tool):
- http://dinosaur.compilertools.net/yacc/ (not derivative-based, but not hand-written)
- http://matt.might.net/articles/parsing-with-derivatives/
- http://matt.might.net/articles/implementation-of-regular-expression-matching-in-scheme-with-derivatives/
- http://matt.might.net/teaching/compilers/spring-2013/derp.html
- http://hackage.haskell.org/package/derp
And here are some handy references:
It was highly recommended to me to use derp (derivative-based Racket parsing tool), so I'll probably end up doing that. However, I plan on researching both options just because they're interesting.
No comments:
Post a Comment