On Fri, Aug 20, 2010 at 6:05 AM, Jason Dagit <dagit@codersbase.com> wrote:
On Thu, Aug 19, 2010 at 8:05 PM, Michael Litchard
<michael@schmong.org> wrote:
I'd like the community to give me feedback on the difficulty level of
implementing an awk interpreter. What language features would be
required? Specifically I'm hoping that TH is not necessary because I'm
nowhere near that skill level.
Implementing an awk interpreter in Haskell can be a fun project. I have a half finished implementation lying around on the hard drive. It's perfectly possible to implement it without using any super fancy language features. But as other people have pointed out, monads are helpful for dealing with a lot of the plumbing in the interpreter.
You might also focus on the 'core' of awk. Think about, what is the minimal language and start from there. Grow your implementation adding features bit by bit. It's also a good opportunity to do testing. You have a reference implementation and so you can write lots of tests for each feature as you add them.
When I wrote my awk interpreter I decided to go for the whole language from start. I had reasons for doing this as there were certain aspects of this that I wanted to capture but it is not they way I would recommend going about it. I definitely second Jason's advice at trying to capture the core functionality first.
Have fun,
Josef