Re: a newbie's dumb question...

rkrayhawk@aol.com (RKRayhawk)
27 Jul 2001 02:53:33 -0400

          From comp.compilers

Related articles
a newbie's dumb question... explosion78@hotmail.com (2001-07-18)
Re: a newbie's dumb question... kvinay@ip.eth.net (Vinay Kakade) (2001-07-23)
Re: a newbie's dumb question... joachim_d@gmx.de (Joachim Durchholz) (2001-07-23)
Re: a newbie's dumb question... haberg@matematik.su.se (2001-07-23)
Re: a newbie's dumb question... hirner@yahoo.com (ThaFacka) (2001-07-23)
Re: a newbie's dumb question... rkrayhawk@aol.com (2001-07-27)
Re: a newbie's dumb question... james.grosbach@microchip.com (James Grosbach) (2001-07-30)
| List of all articles for this month |

From: rkrayhawk@aol.com (RKRayhawk)
Newsgroups: comp.compilers
Date: 27 Jul 2001 02:53:33 -0400
Organization: AOL http://www.aol.com
References: 01-07-124
Keywords: design
Posted-Date: 27 Jul 2001 02:53:33 EDT

Another way to look at this is to focus on why you are considering a
grammar tool in the context of PIC micros. If your interest is the PIC
assembly language and the various classes of devices, then the
executables are already available from the vendor.


So one presumes that the interest is part academic or
self-development, thus the valance an this inquiry is probably the
oposite. The PIC devices are a very ideal target for someone focusing
on lexers and parsers for the first time!


Your error recovery considerations might be eased if you recognize
from the start that the topology of an assembler language for these
devices has very few acceptable patterns.


In all probability you can legitimately impose a
single-line-single-instruction requirement on the source code, and
then accept about four basic line patterns:


blank lines
comment only lines
lines with commands only
lines with command and comments.


You could handle the blank lines in the lexer; and if you choose to exploit
states, even the comment only lines could be trifles for the lexer.


That leaves only a couple of things for the parser to munch on




optional-label command destination, source


then you could deploy a few obvious error production rules like


command command


or


recognized-command plus-any-extra-recurse.




The exact value of the PIC devices as targets is that you can get reasonable
quickly to the real chores of compiler development, without beign bogged down
in infinitely recursive language syntax.


Your basic decision will be to design the productions as immediate code
generators on the fly, or to design the productions as syntax tree constructors
with judiciously triggered tree walkers as the code generators.


Best Wishes


Robert Rayhawk
rayhawk@alum.calberkeley.org


Post a followup to this message

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