[Haskell-beginners] A Pascal-like Language Compiler
spranesh at gmail.com
Wed Oct 22 18:18:24 EDT 2008
Thanks to everyone for replying. I was severly caught up with work for
the last two days.
The link Larry gave for the lookahead states seems very nice :). But I
am not sure if Ill be looking to calculate the lookahead states myself,
or let BNFC do the job? In either case, I think merely printing the line
number where the error occured should do in the worse case. It will be
exciting to have nice error messages though.
I am starting to reliase the advantage of pattern matching being
present, like Chris had said. I mean it definitely beats maintaining
and checking a flag, the way you would do it in C :)
> Definitely not, just go for it. In the IPL course @ UU we implemented
Thanks, Chris :).
> 1. Parse input file into an abstract syntax tree representation.
> 2. Perform type checking on your syntax tree.
> 3. Transform the syntax tree using re-write rules and optimisations.
> 4. Pretty print the syntax tree in order to output code of your target language.
That seems like a very nice scheme to follow. I had a similar method in
mind. Step 3 is what I am really worried about. How easy/difficult will
it be in a pure func language, to "transform" the sytnax tree.
I have to take a deeper look at BNFC. But from an initial look, it seems
way too powerful for me to use? At least as powerful as yacc. And that
with Haskell, should give me a very good toolset-advantage?
@Chris : The ipl course website, seems very helpful, especially some of
the lectures on abstract syntax.
Third Year Student,
Computer Science & Engineering,
Indian Institute of Technology - Madras.
More information about the Beginners