SEG 2101 - PowerPoint PPT Presentation

1 / 4
About This Presentation
Title:

SEG 2101

Description:

Extra notes from class (January 13, 1999): interpreter and ... 'regular' grammar e.g. Language is {a, ab, abb, ...} start symbol A a | a B B b | b B ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 5
Provided by: jingl1
Category:
Tags: seg | ab | extra

less

Transcript and Presenter's Notes

Title: SEG 2101


1
SEG 2101
NEW LAB TIME AND LOCATION WEDNESDAY 1300 -
1600 MCD 121


Extra notes from class (January 13, 1999)
interpreter and compiler (do you know the
difference? What about Java?)
Java
translator

source
Byte Code (1 Byte per character)
Java VM

compiled
Interpreted
Compiled
components
(unfortunately, into machine-dependent object
code)
Interpreted
not portable
string
-- this string contains characters from a
different alphabet (namely Russian). To
understand this string, we need to understand the
characters of the alphabet (Cyrillic, with the
mapping as shown). Now, we see that the string in
our alphabet is RESTORAN.
P E C T O P A H
R S R N
Language is a set of strings over an
alphabet.generated according to a grammar. E.G.,
the English language contains sentences.
ltsentencegt ltnoun phrasegt ltverb
phrasegt ltobject phrasegt
BNF
E.g., Bob put out the cat
Object phrase
Backus Naur Form
Noun phrase
Verb phrase
2
ltaddressgt ltidgt _at_ lthostgt
_at_ lthostgt _at_ ltpathgt ltdomain namegt
"context-sensitive production (has _at_ on both
LHS and RHS - context).
ltaddressgt ltuseridgt _at_ lthostgt

lthostgt ltprefixgt
lthostgt ? ltdomain suffixgt
alpha 1256
(Extened BNF)
"context-free production (has one non-terminal
on LHS)
regular grammar e.g. Language is a, ab, abb,

start symbol ltAgt a a ltBgt
ltBgt b b ltBgt
regular product
__________________________________________
BNF
lttermgt lttermgt ltfactorgt
lttermgt ltfactorgt
lttermgt ltfactorgt
ltfactorgt
____________________________________________
EBNF
lttermgt ltfactorgt ltfactorgt The
previous BNF syntax tree could be written
lttermgt ltfactorgt ( ltfactorgt) 3
3
?
lt
alphagt A B C Y Z

Þ
lt
alphanumericgt
ltalphagt ltnumericgt
Þ
lt
numericgt
0 1 9
lt
alphanumericgt 0..8 is an alphanumeric string
containing from 0 to 8 characters.
is an alphanumeric string containing EXACTLY 8
characters.
8
ltalphanumericgt
If ltdirectorygt
Þ
ltalphagt ltalphanumericgt 0..8,
E.g., SEG 2101 is a valid lexeme of the
ltdirectorygt token.
4
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com