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

Don Stewart dons at galois.com
Fri Aug 20 13:18:40 EDT 2010


There's a lot of examples of languages implemented in Haskell to choose
from, too

    http://haskell.org/haskellwiki/Applications_and_libraries/Compilers_and_interpreters#Large_languages

michael:
> Thank you all for your encouragement. I need to think about the core
> functionality, and do some reading.
> 
> On Fri, Aug 20, 2010 at 2:33 AM, Josef Svenningsson
> <josef.svenningsson at gmail.com> wrote:
> > 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,
> > Josef
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 


More information about the Haskell-Cafe mailing list