2

A grammar as well.

If one were to approach a generic parser from the ground up how would one go about it? I've looked at ANTLR and Irony, but they are more tools than methodologies. What are the steps one should tackle and the milestones for accomplishment?

3
  • 1
    Eric Lippert has a great series on this sort of thing on his blog... let me see if i can't dig up a link.
    – asawyer
    Feb 15, 2011 at 20:30
  • First of all you should define your grammar. It decides what class of parsers you can use. Or you tailor it to suit a certain class.
    – Skurmedel
    Feb 15, 2011 at 20:30
  • 2
    You might be long past this stage but I wrote an article on codeproject once abot a simple parsser from scratch in C#. This might give you some ideas. codeproject.com/KB/linq/TinyLisp.aspx
    – gjvdkamp
    Feb 15, 2011 at 20:55

3 Answers 3

2

Large topic my friend. If you want to learn about the theory the best place to go is 'the Dragon Book': http://www.amazon.com/Compilers-Principles-Techniques-Tools-Gradiance/dp/0321547985/ref=sr_1_2?s=books&ie=UTF8&qid=1297801900&sr=1-2

Another good place to look if you want to devlope for .Net is the F# power pack. THis contains fsLex and fsYacc.

Good luck!

GJ

1
  • Thanks for the link in your comment on the Q. I knew about teh dragon book but don't have it. Lex and Yacc in F# is news to me. I'm definitely going to explore your Codeproject article.
    – cazlab
    Feb 15, 2011 at 21:07
1

http://blogs.msdn.com/b/ericlippert/archive/2010/04/19/every-binary-tree-there-is.aspx

Start here, there is a good handfull of posts on the subject it's a very good read.

-edit- hm this isnt exactly the start of the series, and it changes to "Every program there is"

I wonder if the whole thing is tagged or listed somewhere already...

0
1

Your post got my interest in this stuff started again, here's some more useful links. They're all in F# though. You mentioned .Net so it does fit the bill. Actually for this type of work F# is by far the best language to do it in.

http://www.quanttec.com/fparsec/

http://strangelights.com/blog/archive/2006/05/11/1302.aspx

2
  • ooo thanks @gjvdkamp; Off topic a bit, but how would you say F# stacks up against erlang or haskell?
    – cazlab
    Feb 23, 2011 at 17:47
  • Hmm.. I don't consider myself to be in any position say something meaningful there, only know some F# and I'm really starting to like it. It has the upside that it plays nicely with the entire .Net ecosystem. The other two I know only by name so you'd have to ask the Google.
    – gjvdkamp
    Feb 23, 2011 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.