2

Consider the following BNF Grammar G:

object-expression   ::=     id | id ( object-expression ) | object-expression . id
                            | object-expression [ object-expression ]
                            | object-expression . id ( object-expression )

I am attempting to construct a set of LR(1) items based on G.

Attempt:

Let's represent Grammar G as:

O -> id
O -> id ( O )
O -> O . id
O -> O [ O ]
O -> O . id ( O )

Item Set 1:

O' -> • O, $
O -> • id, $
O -> • id ( O ), $
O -> • O . id, $
O -> • O [ O ], $
O -> • O . id ( O ), $

Can someone provide an intuitive explanation in simple language on how to finish obtaining a set of LR(1) items given a BNF Grammar such as G?

Please let me know if I can provide any more information.

Grant Miller
  • 143
  • 2
  • 2
  • 11

0 Answers0