Related articles |
---|
Bottom-up versus Top-down jacko@post8.tele.dk (Jack Olsen) (1997-11-23) |
Re: Bottom-up versus Top-down thetick@magelang.com (Scott Stanchfield) (1997-11-24) |
Re: Bottom-up versus Top-down gnb@itga.com.au (Gregory Bond) (1997-11-28) |
Re: Bottom-up versus Top-down gclind01@spd.louisville.edu (1997-11-29) |
Re: Bottom-up versus Top-down mkgardne@cs.uiuc.edu (1997-11-30) |
Re: Bottom-up versus Top-down henry@zoo.toronto.edu (Henry Spencer) (1997-11-30) |
Re: Bottom-up versus Top-down rod.bates@wichita.boeing.com (Rodney M. Bates) (1997-12-02) |
Re: Bottom-up versus Top-down henry@zoo.toronto.edu (Henry Spencer) (1997-12-02) |
Re: Bottom-up versus Top-down thetick@magelang.com (Scott Stanchfield) (1997-12-02) |
[9 later articles] |
From: | Gregory Bond <gnb@itga.com.au> |
Newsgroups: | comp.compilers |
Date: | 28 Nov 1997 00:52:53 -0500 |
Organization: | ITG Australia Ltd. Melbourne, Australia |
References: | 97-11-123 |
Keywords: | parse |
Jack Olsen <jacko@post8.tele.dk> writes:
Could anyone enlighten me about bottom-up versus top-down parsing?
Hmmm, let me anthropomorphise a bit:
A bottom up parser says things like
- hmm, I have tokens like "i := i + 1;"
- That's an Expression!
- hmm, I have tokens like "begin Expression ; Expression ; end"
- That's a Block!
- hmm, I have tokens like "procedure foo Block"
- That's a ProcDef!
- hmm, I have tokens like "program bar Procdef Procdef Block"
- That's a Program!
whereas a top down parser says things like:
- I'm compiling a Program, so I need
"program bar Procdef Procdef Block"
- I'm compiling a Procdef so I need
"procedure foo Block"
- I'm compiling a Block so I need
"begin Expression ; Expression ; end"
- I'm compiling an Expression so I need
"i := i + 1;"
- Got it, so this must be a valid Program.
Hope that helps more than it hinders!
--
Gregory Bond ITG Australia Ltd, Melbourne, Australia
<mailto:gnb@itga.com.au> <http://www.bby.com.au/~gnb>
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.