Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

context free grammar

Posted on 1999-07-30
15
Medium Priority
?
468 Views
Last Modified: 2012-06-27
CAN ANYONE TELL ME HOW TO CONSTRUCT CONTEXT FREE GRAMMAR &
ALSO SPECIFY THE START SYMBOL,TERMINAL SYMBOL,NON-TERMINAL
SYMBOL & PRODUCTIONS FOR THE FOLLOWING:
i>DO...WHILE STATEMENT OF 'C' LANG.
ii>FOR STATEMENT OF 'C' LANG.
0
Comment
Question by:k_f_v
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +5
15 Comments
 
LVL 3

Expert Comment

by:Iexpert
ID: 1264112
ARE YOU WRITING IN CAPS SO YOUR QUESTION
IS CONTEXT FREE? :-)
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1264113
OR CONTENT FREE? ;)
0
 
LVL 5

Expert Comment

by:ecw
ID: 1264114
look in the back of K&R
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Accepted Solution

by:
ahoffmann earned 800 total points
ID: 1264115
dowhile: DO block WHILE ( expression ) ;
for:   FOR ( expression ; expression ; expression ) block
expression:
      /* a lot of things to write here .. */
block: /* a lot ... */
0
 
LVL 84

Expert Comment

by:ozo
ID: 1264116
the for expressions above are optional, "block" might also be called "statement",
and the keywords are actually lower case
0
 

Author Comment

by:k_f_v
ID: 1264117
could u please elaborate more
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 1264118
suggest a structure in some language, and I'll explain how it's CF grammar is constructed. ok, k_f_v?
0
 
LVL 84

Expert Comment

by:ozo
ID: 1264119
block:
        labeled-statement
        compound-statement
        expression-statement
        selection-statement
        iteration-statement
        jump-statement

iteration-statement:
        while
        dowhile
        for

labeled-statement:
        identifier: block
        CASE constant-expression : block
        DEFAULT : block

compound-statement:
        { declaration-list«opt» statement-list«opt» }

declaration-list:
        declaration
        declatation-list declaration

statement-list:
        block
        statement-list block

expression-statement:
        expression«opt» ;

selection-statement:
        IF ( expression ) block
        IF ( expression ) ELSE block
        SWITCH ( expression ) block

jump-statement:
        GOTO identifier ;
        CONTINUE ;
        BREAK ;
        RETURN expression«opt» ;

expression:
        assignment-expression
        expression , assignment-expression

assignment-expression:
        conditional-expression
        unary-expression assignment-operator assignment-expression

unary-expression: /* a lot ... */
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 1264120
ozo has it.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1264121
hmm, I was in a hurry when I typed my answer just out of the brain (just some more letters than ecw's comment suggests ;-)
But looking at ozo's last comment, I think we'll end up in the whole K&R grammer

Did someone have a K&R for k_f_v ?
<G>
0
 

Author Comment

by:k_f_v
ID: 1264122
do u mean the book by k&r .which edition.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1264123
Any "Programming in C" should contain the grammer, regardless the edition (mine is from arround 1982).
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6821429
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects that and the expert will now receive these points, all verified.

Please click on your Member Profile, select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.
 
Thanks,
Moondancer
Moderator @ Experts Exchange
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6821443
IMHO it would be fair to grade ozo too.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6821531
Thanks, I will send this to another Moderator to review and assess, appreciate the input.  BUT, these were all decisions of the Asker initially and if we now return to all of these countless thousands and do additional manual steps, the mountain will never be climbed.  We are merely finalizing what persons originally did (or intended to do) when they accepted the Qs.  If we now return to modify them to split points, it means reducing this value and posting new ones.

Asking for another Moderator's help here, my plate is overly full.

Thanks,

EE Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question