The Gateway to Computer Science Excellence
0 votes
44 views
Say I have a grammar, S→ AB

                                        A→ a

                                        B→ b

This grammar is not operator grammar as 2 non terminals are lying side by side, but can be converted to an operator grammar. S→ ab , A→ a , B→ b

here i have a doubt, operator grammar as the name suggests should have a operator in between right? how can we operate even two  terminal symbols when placed side by side? Isn’t it same as placing 2 non-terminal symbol side by side?
in Compiler Design by Active (3.5k points)
edited by | 44 views
0

@srestha

Help..

0

how can we operate even two  terminal symbols when placed side by side? 

means, which operation?? 

0

like S--> ab is a valid production in operator grammar, but there is no operation between ab, so how can it be a part of operator grammar?

0
why $S\rightarrow ab$ , why it will not a operator grammar??

but  here $A\rightarrow a$

$B\rightarrow b$ are useless production
0
I am not denying S--> ab is not an operator grammar..

but i am unable to understand what is  the logic behind not taking two non terminals side by side, where as taking two terminals adjacent to each other is absolutely fine..! Why is this rule?  I haven't found any proper explanation.
+1

if there are any terminals, that means production atleast terminates.

Operator-precedence parsers can be constructed for a large class of context-free grammars.

and in CFG we have no need of two non-terminal side by side

https://en.wikipedia.org/wiki/Operator-precedence_grammar 

0
Okay..Thank u.. 🙂

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,644 questions
56,512 answers
195,560 comments
101,074 users