f



Production missing on page 9 of Compiler Construction

Hello,

I'm reading Compiler Construction, by Niklaus Wirth, available on
http://www.oberon.ethz.ch/WirthPubl/CBEAll.pdf and on page 9 he shows
this little piece of BNF:

E = T | A "+" T.
T = F | T "*" F.
F = V | "(" E ")".
V = "a" | "b" | "c" | "d".

A is being used on the right hand side without it being defined on the
left hand side first. What am I missing?

The only thing I can think of is that it is missing a production at
first, like:

A = E

>From this BNF it writes this "programs" (on page 10):

a*b+c
a+b*c
(a+b)*(c+d)

Thanks.
0
pupeno (54)
9/1/2007 12:34:57 AM
comp.compilers 3310 articles. 1 followers. Post Follow

3 Replies
648 Views

Similar Articles

[PageSpeed] 45

pupeno@pupeno.com wrote:

> I'm reading Compiler Construction, by Niklaus Wirth, available on
> http://www.oberon.ethz.ch/WirthPubl/CBEAll.pdf and on page 9 he shows
> this little piece of BNF:
>
> E = T | A "+" T.
> T = F | T "*" F.
> F = V | "(" E ")".
> V = "a" | "b" | "c" | "d".
>
> A is being used on the right hand side without it being defined on the
> left hand side first. What am I missing?

IMO it's a typo, should read 'E'.
E = Expression
T = Term
F = Factor
V = Value
A is not mentioned elsewhere.

DoDi

0
Hans
9/1/2007 2:36:58 AM
pupeno@pupeno.com schrieb:
> I'm reading Compiler Construction, by Niklaus Wirth, available on
> http://www.oberon.ethz.ch/WirthPubl/CBEAll.pdf and on page 9 he shows
> this little piece of BNF:
>
> E = T | A "+" T.
> T = F | T "*" F.
> F = V | "(" E ")".
> V = "a" | "b" | "c" | "d".

> A is being used on the right hand side without it being defined on the
> left hand side first. What am I missing?

Hello,

I think, it is an erratum. Solution: Within the production 'E = T | A
"+" T.' replace 'A' by 'E'.

The sentence above the cited section reads as follows:

"The symbols E, T, F, and V stand for expression, term, factor, and
variable."

Please confer the german edition of the referenced paper:

Wirth, Niklaus:
Grundlagen und Techniken des Compilerbaus / Niklaus Wirth. -
Bonn; Paris [u. a.]: Addison-Wesley, 1996
ISBN 3-89319-931-4

On page 6 you will find the following productions:

"(...) Die Symbole A, T, F und V stehen f|r Ausdruck, Term, Faktor und
Variable.

A = T | A "+" T.
T = F | T "*" F.
F = V | "(" A ")".
V = "a" | "b" | "c" | "d".

(...)"

Regards,
Adrian Devries
0
Adrian
9/2/2007 3:37:12 PM
"pupeno@pupeno.com" <pupeno@pupeno.com> writes:


> E = T | A "+" T.
> T = F | T "*" F.
> F = V | "(" E ")".
> V = "a" | "b" | "c" | "d".
>
> A is being used on the right hand side without it being defined on the
> left hand side first. What am I missing?
>
> The only thing I can think of is that it is missing a production at
> first, like:
>
> A = E

Alternatively, you can simply replace the "A" by an "E".  It has the
same effect as adding A = E, but it doesn't make the grammar larger.

In all likelyhood, Wirth originally used A for the German/Swiss word
"Ausdruck" (meaning "Expression") and changed it to E for "Expression"
but missed a spot.

	Torben
[Thanks also to several other people who sent in similar messages. -John]
0
torbenm
9/3/2007 7:09:23 AM
Reply:

Similar Artilces:

which compiler compiled?
Is there a way I can tell which compiler compiled an executable? I looked at the file with a hex editor and didn't see anything obvious. Lawrence "Lawrence" <just4me@nowhere.com> writes: > Is there a way I can tell which compiler compiled an executable? Yes with some compilers and some executable formats. E.g. on HP-UX for PA-RISC: $ aCC leak.C $ odump -compunit a.out ... 6 0 ANSI C++ leak.C /tmp ctcom options = -inst compiletime -diags 523 -inline_power 1 -longbranch 2 -unique_strings on -cachesize 256 B...

Compile or not compile?
There's something that sometimes in while it bores me a little bit. How do I know if I need to compile a function/procedure or it will be able to compile "on fly". At the beginning I thought this was related to the paths idl "knew", but this happens for two functions/routines in the same directory. Can someone tell when a function can be runned without be compile? Nuno Oliveira wrote: > There's something that sometimes in while it bores me a little bit. How > do I know if I need to compile a function/procedure or it will be able > to compile &quo...

Compiling Compiler
Hi there, I need some advice/opinion of the experts out there regarding compilers. I have sun cc compiler that supports 64 bit environment. Now, I compile ACK using this compiler.This should give a compiler that supports 64bit environment. Since the output files are in Solaris format, I compile the ACK source *once again* using the just compiled ACK compiler so that I get Minix object and binary files. Now my questions is that does this 2nd version of ACK be able to produce true 64bit code? Sanky wrote: > Hi there, > > I need some advice/opinion of the experts out there regarding...

To compile or not to compile
Is there some benefit in compiling the apache source yourself? -- //Points ------------------------------------------------------------ http://underthebed.homeip.net ...

To compile or not to compile
Is there some benefit in compiling the apache source yourself? -- //Points ------------------------------------------------------------ http://underthebed.homeip.net ...

Compiled or not compiled
I need to distinguish between two situations: one when a Matlab function is run from Matlab command window and the other one when it is run in compiled mode. Any ideas how to do this? Thanks Tomy Duby "Tomy Duby" <tomy.duby@agilent.com> wrote in message news:idq8q8$85k$1@fred.mathworks.com... > I need to distinguish between two situations: one when a Matlab function > is run from Matlab command window and the other one when it is run in > compiled mode. > Any ideas how to do this? HELP ISDEPLOYED. -- Steve Lord slord@mathworks.com comp.s...

Catalog of Compiler Construction Products
Archive-name: compilers/construction-tools Last-modified: 2001/08/28 Version: 18 Catalog of Compiler Construction Products - Eighteenth Issue This posting may be reproduced in any form without further permission, as long as it is left unchanged. August 2001, transformal GmbH, Berlin. EIGHTEENTH ISSUE This catalog lists products and services for the construction of programming language compilers and related programming tools. It covers compiler generators, corresponding grammars, reusable parts of compilers, reusable parts of other programming tools and related consulting or programming ser...

compiling Qt .... compiling Qt ....compiling Qt.... compiling Qt
I got myself new kernel from kernel.org... make xconfig needs Qt (new system). So I got new Qt source this afternoon. It is still compiling.... Who said MS is bloat has not done this. What does Qt do? Dunno, how about xforms for xconfig? On Thu, 02 Feb 2006 19:18:09 +0000, Jan Panteltje wrote: > Dunno, how about xforms for xconfig? Why not curses based? menuform -- Hilsen/Regards Michael Rasmussen http://keyserver.veridis.com:11371/pks/lookup?op=get&search=0xE3E80917 On a sunny day (Thu, 02 Feb 2006 21:55:33 +0100) it happened Michael Rasmussen <mir@miras.or...

program that compiles in C compiler but not in C++ compiler
Hi, I need a small program that compiles in C compiler but not in C++ compiler. Thx in advans, Karthik Balaguru KBG <karthik.balaguru@lntinfotech.com> wrote: > I need a small program that compiles in C compiler but not in C++ > compiler. No problem, just send $10 to paypal@zevv.nl and I'll do your homework for you. -- :wq ^X^Cy^K^X^C^C^C^C KBG said: > Hi, > > I need a small program that compiles in C compiler but not in C++ > compiler. Can you think of any syntactic differences between C and C++? For example, what about keywords? They are very, very sen...

compiling on different compilers
I am working on a set of functions that involve dynamic memory allocation. I started working with gcc and then moved to Pacific C. The reason was that my only access to gcc was through an ssh connection that I did not have access to all the time, so I got Pacific so I could work on my home windows computer. Then I moved back to gcc, which saved me from some major mistakes. Somehow Pacific C was letting me get away with stuff that was completely wrong. gcc immediately gave me segmentation errors until I got every last thing correct. Is gcc the best for catching mistakes? If not, which on...

Compiling with the eclipse compiler
Hey all,I have a weird problem (at least it's weird to me).I have a big project that I need to compile through ant with eclipse'scompiler.In the build.xml my compile target looks like this : <target name="compile" depends="release-settings, init" description="compiles everything from source"> <echo message="Compiling with debug = ${build.debug}"/> <depend srcdir="${src.dir}" destdir="${class.dir}" cache="${dependencies.dir}" closure="true"/> <javac srcdir=...

Meta4... a compiler-compiler
in the csa2 gmail account... description is very interesting. in the Pidgin for Apple II/Merlin/6502 message Rich ...

which compiler was used to compile?
Is there a slick way to invent a constant in a program that tells you which compiler you used. I distribute both JET and JavaC versions of my code, and it helps to know on any error dump which version they were using. Right now I manually change a static final just before compiling. I thought there ought to be something less error prone. -- Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary. Roedy Green wrote: > Is there a slick way to invent a constant in a program that tell...

Compiling Abiword: Has anyone successfully compile it on Solaris 9?
Hello, I was wondering if anyone has able to build Abiword 1.0.6 on Solaris 9? So far it keep bombing on compiling the wv libararies. I "hacked" the build by adding the lastest sources of the wv libarary and moving the Makefile.abi into the source. That got me further but now I get this big error message. make[2]: Entering directory `/home/jogee/abiword-1.0.6/abi/src/af/gr/unix' Building with [LicensedTrademarks:Off Debug:Off BiDi:Off Gnome:Off LibXML:Off Ps pell:Off Scripting:Off]. gr_UnixImage.cpp: <command line>:13:1: warning: "_XOPEN_SOURCE" redefined <...

Web resources about - Production missing on page 9 of Compiler Construction - comp.compilers

Construction - Wikipedia, the free encyclopedia
Construction starts with planning, design, and financing and continues until the project is built and ready for use. Large scale construction ...

Construction - Wikipedia, the free encyclopedia
Construction starts with planning, design, and financing and continues until the structure is ready for occupancy. Far from being a single activity, ...

Construction - Wikipedia, the free encyclopedia
Construction starts with planning, design, and financing and continues until the structure is ready for occupancy. Far from being a single activity, ...

Gungahlin mosque group relieved to see end of battle over its construction
Protracted legal dispute stymied construction of the Gungahlin mosque for more than three years.

George Street's biggest peak-hour test as light rail construction ramps up
The first day back at work for many Sydneysiders will coincide with the biggest test yet for the city's peak-hour traffic and the closure of ...

Tableau's growth fuels more construction, and this time it's a new Seattle office building
... by leasing 92,000 square feet in Kirkland Urban, a large mixed-use campus in downtown Kirkland. Because the deal will help kick off construction ...

Diving Into the Revisions: Construction Spending Revised Lower 8 Consecutive Months! 2015 GDP Will Decline ...
Understanding the Construction Revisions Yesterday I commented Government "Processing Error" Sinks Housing Reports for Entire Year . In that ...

Construction Spending decreased 0.4% in November, Up 10.5% YoY
The Census Bureau reported that overall construction spending decreased in November compared to October: The U.S. Census Bureau of the Department ...

Apple starts construction on its first Singapore retail store
Photos have surfaced online showing work underway on Appleā€™s first retail store in Singapore. The photos show that Apple is taking its regular ...

Moscow Just Set A Record For Residential Construction: Is A Housing Bust On The Way?
... seemingly defiedthe laws of economic gravity. On a population-adjusted basis, 2014 saw Russia set a post-Soviet record for new housing construction. ...

Resources last updated: 1/24/2016 8:37:58 AM