Re: Grammar First Set



In article <1192037246.070904.264340@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
_nabuchodonozor <kkocemba@xxxxxxxxxxxxxx> wrote:

E' -> E $
E -> T N
N -> + T N | - T N |
T -> F M
M -> * F M | / F M |
F -> id | ( E )

Using the following grammar I have to compute the First(*FM).
I did sth like this but I think It is wrong:/
First(*FM) = First(*) U FIrst(F) U (First(M) - { })
= {*} U {id, ( } U ({*,/, } - { })
= {*, id, ( , / }


I read a lot of examples about it but I cannot understand this
subject:/ Could you tell me what I did wrong?
Please help me.

Sorry if it is a quastion not to this group

The FIRST set for a sequence <S> of grammar symbols is the set of
terminals that can appear as the first element of some string derived by
zero or more reductions from <S>. Any string derived from *FM, given
your grammar, must begin with *, since that is a terminal symbol.

On the other hand, if your sequence is FM, then since F is not nullable,
your first set would be ID and "(".

Taking the set union does not make sense in this example; you cannot
proceed past a symbol in the computation of first sets unless that
symbol derives the empty string.

Cheers,
-M

--
Michael J. Fromberger | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA
.



Relevant Pages

  • Re: query unique count for field
    ... Michel, ... I am trying to apply this new grouped sequence to ... >> first set of records. ... > and the last query would produce: ...
    (microsoft.public.access.queries)
  • Re: query unique count for field
    ... From your valuable help, I now ... I am trying to apply this new grouped sequence to ... > first set of records. ... and the last query would produce: ...
    (microsoft.public.access.queries)
  • Re: Compactness in Hilbert spaces
    ... >>> I am just beginning to learn Hilbert space theory, ... >>The first is a closed ball, so yes, it's closed and>bounded. ... how is the first set a closed ball if a_n can be any l^2 sequence? ...
    (sci.math)