[Haskell-cafe] feasability of implementing an awk interpreter.

Josef Svenningsson josef.svenningsson at gmail.com
Fri Aug 20 05:33:05 EDT 2010

On Fri, Aug 20, 2010 at 6:05 AM, Jason Dagit <dagit at codersbase.com> wrote:

> On Thu, Aug 19, 2010 at 8:05 PM, Michael Litchard <michael at 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.

An outline of a possible approach would be appreciated. I am using
>> http://www.math.utah.edu/docs/info/gawk_toc.html
>> as a guide to the language description.
> 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,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100820/46917385/attachment.html

More information about the Haskell-Cafe mailing list