|Terminals, non-terminal, syntax, semantics: some really naive questi email@example.com (Robert Myers) (2003-03-09)|
|Re: Terminals, non-terminal, syntax, semantics: some really naive qu firstname.lastname@example.org (Carl Cerecke) (2003-03-14)|
|From:||Carl Cerecke <email@example.com>|
|Date:||14 Mar 2003 11:22:25 -0500|
|Posted-Date:||14 Mar 2003 11:22:25 EST|
Robert Myers wrote:
> Hello, all:
> I find myself in the position of needing to know more about compilers
> than I thought I would ever want to know.
Some of us do it for fun!
Forget trees etc. and consider this small example:
This is a grammar that defines a language. S is the start symbol of
the language. All sentences in the language can be derived starting
from S and following the arrows. When you follow an arrow you can
think of it as replacing the symbol on the LHS with the symbol(s) on
S -> A a | B a
A -> x y
B -> z
A symbol that can be replaced is a non-terminal (S, A, B)
A symbol that is a token in the language is a terminal
(a, x, y, z)
All non-terminals must appear at least once on the LHS
of an arrow. No terminals ever appear on the LHS.
You should be able to see reasonably easily that S
derives (and can only derive) the two sentences "xya"
Hope that helps,
Return to the
Search the comp.compilers archives again.