Using BTYACC to write C compiler

Jules <J.R.Hall@dcs.warwick.ac.uk>
8 May 1996 00:24:31 -0400

          From comp.compilers

Related articles
Using BTYACC to write C compiler J.R.Hall@dcs.warwick.ac.uk (Jules) (1996-05-08)
Re: Using BTYACC to write C compiler Scott.Nicol@infoadvn.com (1996-05-10)
Re: Using BTYACC to write C compiler rfg@monkeys.com (1996-05-19)
| List of all articles for this month |

From: Jules <J.R.Hall@dcs.warwick.ac.uk>
Newsgroups: comp.compilers
Date: 8 May 1996 00:24:31 -0400
Organization: Compilers Central
Keywords: C, question, comment

I am relatively new to compiler writing, and after reading this
newsgroup for a while decided that a good place to start would be by
learning the how to use the BTYACC utility, which is apparently highly
recommended.


I have a requirement to have a working [ANSI] C compiler, that
produces output in a format recognisable by a particular assembler,
and which is capable of compiling both itself and that assembler (for
an operating system project I am involved in).


I have started work with the ``ansiC.y'' and ``ansiC2.y'' grammars
that were included in the BTYACC package, and wrote a lexical analyser
for these using FLEX. My problem is that while trying to parse my
assembler (which is an almost correct ANSI C program, and at least
accepted as syntactically correct by every C compiler I've tried it
on), the grammar freezes after a certain point, and I am unsure why.


Do you have any advice on techniques I could use to work on this
problem, or are there any known bugs in the ansiC.y and ansiC2.y
specifications (the same happens whichever of these I use), or in
BTYACC itself that could cause this?


I must confess to being completely stumped.


The sources for the program I am attempting to parse are a little too
large to include here, if you would like to have a look at my code,
email me and I'll send you a copy by mail.


Thanks in advance for your help,




Jules.


--
Julian R Hall preferred --->> jules@dcs.warwick.ac.uk
http://www.dcs.warwick.ac.uk/~jules/ csusb@csv.warwick.ac.uk
THE NETWIDE ASSEMBLER PROJECT: http://www.dcs.warwick.ac.uk/~jules/nasm1.html
[I'd start with lcc. There's a lot more to a C compiler than the parser.
-John]
--


Post a followup to this message

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