Re: 'Learning Compilers': Functional vs. Imperative Host?

Jim Witte <jswitte@bloomington.in.us>
3 Apr 2004 09:09:51 -0500

          From comp.compilers

Related articles
'Learning Compilers': Functional vs. Imperative Host? jswitte@spam.bloomington.in.us (Jim Witte) (2004-03-19)
Re: 'Learning Compilers': Functional vs. Imperative Host? torbenm@diku.dk (2004-03-26)
Re: 'Learning Compilers': Functional vs. Imperative Host? jswitte@bloomington.in.us (Jim Witte) (2004-04-03)
Re: 'Learning Compilers': Functional vs. Imperative Host? jswitte@bloomington.in.us (Jim Witte) (2004-04-03)
Re: 'Learning Compilers': Functional vs. Imperative Host? jswitte@bloomington.in.us (Jim Witte) (2004-04-03)
Re: Re: 'Learning Compilers': Functional vs. Imperative Host? nmh@t3x.org (Nils M Holm) (2004-04-03)
| List of all articles for this month |
From: Jim Witte <jswitte@bloomington.in.us>
Newsgroups: comp.compilers
Date: 3 Apr 2004 09:09:51 -0500
Organization: IU
References: 04-03-070
Keywords: functional, courses
Posted-Date: 03 Apr 2004 09:09:51 EST

>In particular ML-like languages with
>pattern-matching on data structures make it easy to work on abstract
>syntax trees.


    Here, the compiler course doesn't use ML, but it does use the 'match'
macro, which will let you write something like


(match '(3 + 4) `(,x + ,y) (list (+ x y)) )


and have it put out 7. This lets you do (I'm told) an awful lot of the
AST parsing very easily. As Dr. Friedman likes to put it, "you write a
pass that's 50 lines long, but on every other pass, you only change abuot
2, which is why we have you do 5 passes in a week.." At some point,
they're going to get match up to the point where you don't even have to
copy the 48 lines that *don't* change, you just put in the 2 that do..
Don't ask me how, though.


Jim


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.