You are on page 1of 11

CSC 241 LECTURE NOTE

TRADE-OFFS IN LANGUAGE DESIGN


array elem ents be
ple. Java dem ands that all refer ence s to
1. Relia bility Vs. Cost of Exec ution : For exam
to increased execu tion cost s.
chec ked for prop er index ing, which leads
num ber of new
des many powe rful oper ators land a large
2. Read abilit y vs. Writa bility : - APL provi
at the cost of poor
to be writt en in a comp act prog ram but
symb ols). allow ing comp lex comp utati ons
read abilit y.
very flexib le but
point ers in c++ for Insta nce are powe rful and
3. Writa bility (Flex ibility ) vs. relia bility : The
are unre liable.

IMPLEMENTATION METHODS
machine Language & System ca lls
1. Compilati on - Prog rams are trans lated into

d by anot her prog ram (an inter prete r}


2 Inter preta tion - Programs are inter prete

medi ate langu age for easy inter preta tion


3. Hybrid - Programs trans lated into an inter
time they are calle d.
then comp ile sub prog rams code the first
4. Just -in-t ime - Hybr id imple men tatio n,

COMPILATION
age) into machine code (mac hine language)
- Tran slate d high level prog ram (source langu

- Slow trans lation, fast exec ution

- Com pilati on process has several phases


ifiers , oper ators,
source prog ram into lexical units (e .g. ident
o Lexica l analy sis conv erts cha racte rs in the
keyw ords} .
cti c struc ture of
into parse trees whic h repre sent the synta
o Syntactic analysis: trans form s lexical units
t he prog ram .
rate inter med iate
to dete ct durin g synta ctic analysis; gene
o Semantics analys is check for error s hard
co de.

rated
o Code gene rat ion - M achin e code is gene

- INTERPRETATION
tely be displayed ).
(run -time error s can easily and imm edia
- - Easier Impl eme ntati on of prog rams
than co mpile d prog rams }
- Slo wer exec ution {10 to 100 t ,mes slow er
.
now rare3 for tradi tiona l highl evel languages
Ofte n requ ires more mem ory space and is
like PHP and JavaScript .
Web scripting languages
comeback wit h some
. Sig nifican t
ent as a rea d-eval-print loo p:
. Inte rpr ete rs usually imp lem
e inte rna l for m)
n in the inp ut lan gua ge (usually translating it in som
o Read expressio

ms of the expression
o Evaluates the inte rna l for

luation
o Pri nt the res ult of the eva

t inp ut expression unt il exi t


o Loops and reads the nex
ge:
machine for the source langua
- Inte rpr ete rs act as a virt ual
p
ed by the read-eval -pr int loo
o Fetch execute cycle replac
gram running on
called the inte rpr ete r " run -tim e" tha t is a com pile pro
ent ,
o Usually has a cor e com pon
the nat ive machine.

HYBRID IMPLEMENTAITON
level program is
bet we en com pile rs and pure inte rpr ete rs. A high
mise
- This involves a compro tha t allows easy inte rpr eta tion .
inte rme dia te lan gua ge
translated to an Examples of the
fas ter tha n pure inte rpr eta tion .
imp lem ent atio n is
Hybrid
l and Java.
imp lem ent atio n occur in Per
before inte rpr eta tion .
ly compiled to detect errors
o Perl programs are par tial
e, provides por tability to
s of Jav a we re hyb rid. The intermediate form, byte cod
o Init ial implementat6ion (together, these are called
a byt e cod e inte rpr ete r and a run tim e system
any machine tha t has
Java Virtual Machine).
grams to an inte rme dia te
ATI ON Thi s imp lem ent ation init iall y translates pro
JUST-IN-TIME IMPLEMENT machine code wh en the y
the inte rme dia te lan gua ge of the subprograms into
language then compile
are called .
wid ely used for Java
kep t for sub seq uen t calls. Just-in -tim e systems are
- Machine code version is
JIT system .
ges are implemented wit h a
programs . Also .NET langua
language,
ne language and Assembly
of pro gra mm ing lan gua ge wit h emphasis on Machi
A brie f his tory ipt ing
Ada , C, C++, Java, Pro log, Scr
tran lan gua ge, LISP and pure LISP, Algol, simula 67,
Evolution of For
language for the Web .
MING LANGUAGES.
A BRIEF HISTORY OF PROGRAM

Asscm bl) lan gua ges •

IBM 704 and Fortran - FORm


ulo TRAN:.lation•

'2
I ISP I ISi Processing•

/\U iOL 60 International Algorithmic language•

e•
Si11111I 67 f irst object oriented languag

Ada - histo1)'·s largest des ign effort


- Oriented Features•
C H · Combining lmperaive and Object
Oriented language•
Java - An Imperative - Based Object -

Pro log - Logic Programming•

Lecture Note: Algol, c++, c#

ALGOL computer
(sho rt for ALG Orit hmi c Lan guage 1968) is an imperative
ALGOL 68 the ALGOL 60
ram min g lang uag e thnt was conceived as a successor to
prog e of application
the goal of a much wider scop
programming language. designed with include
rous ly defi ned synt ax and semantics. ALGOL 68 features
and more rigo a
user -dec lared types and structures/tagged-unions,
express ion-base d synt ax.
array and matrix
reference parameters. string and
reference mod el of variables and concurrency .
and also
slicing 20, 1968 the
68 was des igne d by IFIP Wo rking Group 2.1 . On December
ALGOL y approved for
Working Group 2.1 and subsequentl
language was formally adopted by Assembly of IFIP.
by the General
publication invented by Adriaan
OL 68 was defined usin g a two-level grammar formalism
ALG mar to generate
grammars use a context-free gram
van Wijngaarden . Van Wijngaarden program;
set of prod uctions that will recognize a particular ALGOL 68
an infinite that in many other
bl~. they are able to expr ess the kind of requirements
nota are labelled.
language standards
programming
Notable language dl'ments

Uold symbols and resl'rved words


standard sub-language:
e \\-ith "brief symbol" equivalents ) in the
There are 61 such reserved "or ds ( som
mode. op. prio, proc.

flex . heap. toe, long , ref. short,


. sema, string, ,•oid .
bits , bool. bytes. rhar, co,npl. int, real

chunnl'I. file. format, struct. union.


ty, nil " 0 ", skip "- ".
of, ut "11~" . is ":-=. ", isnt ":/:::", ":f:: ", true , false , l'mp

3
t·o com me nt "c". pr. pr
ag ma t,

case in ou se i11 ou t esa c "( ~ I - I: - ! ~ I - )".


,
for fro m to b~· wh ile do od

if the n eli f t/1e11 else fi "( ~


I- I: - I - I - )",
to. go to, exi t". ".
pa r begin end "( - )", go

mode: De cla rat ion s


ce) are real, int , co mp l
ic data types (called mo de s in ALGOL 68 parlan
The bas
ar, bits and bytes . Fo r exa
mple:
(co mplex number). bool, ch

int n = 2;
2.c o
co n is a fix ed constant of

int m := 3;
tially set to 3.
al variable whose value is ini
co m is a newly created loc
loc int := 3; co
This is shon for ref int m = co
Avogadro's number
6.0221 41523; co
ro =
real avogad 88 4197 1 69399 3751 O;
l pi = 3.14 I 59 26535 89 793 23 846 26433 83279 502
lon g long rea
s one = 0l I
com pl square roo t of minu l;. That
syntactic sugar for ref real x = loc rea
real x; is j ust
However, the dec laration erated local real
identifier for a reference to a ne wly gen
stant
is, x is rea lly the con
variable.
Special characters
~. V, /\, , - . !. T, □, l. f. l {, o,
"special " charac ters ( x, .,. ~ . ~. :f.. " print head
Most of Algol's
IBM 27 4 1 key boa rd \\ith the APL "go lf-ball
l and ¢) can be fo
und on the 68 was being
1960s whi le ALGOL
ava ilable in the mid are
insen ed, these became t of the uni code standard and most of them
are also par
drafted. These characters
fonts.
available in several popular
tpu t
Tr ans put: Input an d ou
t facilities. There
d to refer to AL GO L 68's input and outpu
Tran sput i~ the tenn
use fil es and
fon nat ted , fonna tted and binary transput.
s for un ent manner
are pre-defin ed procedure in a con sis ten t and machine -independ
are han dle d
otJ1cr tran sput de\ ices the standard output
prints out som e unformatted output to
·me follo\ving examp le
i is ",' i. "and x(i J is ", x[ iJ,
device ne wline))
itle ", ne ~, Iine, "V alue of
print (( newpagt:. "1

'f
nnd new line passed as arguments.
tl w p1t·ddi11 cd pron·d urcs ncw pngc
( .. 1-
multi-parad igm .
:t•d se1 : plus plus ") is a statically t) ped, free-form.
l I t111,%1 u111 elevel language. as it
gl'lll'ml -pu rpv se prog rn11 1111in g lang uage. It is rega rded as an inlerrnediat
u •111p1k•d . and low-level
tion of both high-level
1.·,,111pn:, r s o com bina Labs
" os dcH '. lope d b) Bja rne Stro ustrup starting in 1979 at Bell
IJnguagc fe11t111'\:s. It . It was
nt to tht· C lang uag e and orig inally named C with Classes
us un enh nnceme ,n
1983.
C++
re11n 111eJ lication dom ains
ne the mos t pop ular prog rammin g languages and its app
l' + +- is 1. > "1
1 f
tion software, device
stem s s0tl war e (suc h as Microso ft Windows), applica
ind ude S)
client application s, and
high-perfon nance server and
dri\'ers. embt•dded software. as vide o games.
soil war e such
entcrtain m1:n1 ct oriented or
lled a hyb rid lnng unge; it is poss ible to write obje
C➔ + is som etim es ca
sed some concern that
the snm e prog ram 111 C++. Thi s has cau
prucedurol cod e III
but are under the
e C++ prog ram mer s arc still wntmg procedural code,
som it 1s
obje ct orie ntat ed. sim ply beca use they are usin g C++ . Often
impress ion 1h01 it is the code is
ntio n of the two . Thi s usua lly causes most problems when
un oma lgam
ther coder.
re, isited or the tnsl-. is taken ove r b) ano
languages to
to be used and is one of the preferred prog rammin g
C++ continu es
de, elop professional applica tions.

Language features
version of the
most of C's S) 111ax . The followin g is Bjame Stroustrup's
C++ inherits e a message to standard
\\ Orld program that uses the C++ standard library stream fac ility to writ
Hello
output:

#include <ios trenm>

int main()

std ::cout <-< "lk llo. " orld!\n";

befo re
type, fa ilu~ to retum a value
Within functions that define a non-void return mpilers
end of the function results in undefin ed behavio ur (co
control ~aches the on to
in such a case). The sole excepti
t) pica ll) pro\- ide the means to issue a diagnos tic zero .
lic itly returns a value of
I.his rule is the mam function, "hich imp overloading
and ope rator
O~ nto n manipul atio n,
mor e than 35 ope rators. coverin g basic arithmetic, bit
C++ pro, ides operators can be
)n.
i~ compari sons. logica l operations and others. Alm ost all
mdirect ons such as member
s, " ith a few notable excepti
o, crlo adcd for user-defined type g C++ as a
• ). The rich set of ove rloa dab le operators is cen tral to usin
ucce::.:. ( nnd

5
esse ntia l par t of
ge. The ove rloa dab le ope rato rs are also an
J oma in-s pec ific lan gua nte rs. Ove rloa din g an
C+ + pro gra mm ing tech niq ues . suc h as sma rt poi
man y adv anc ed inv olv ing the ope rato r, nor
s not cha nge the pre ced enc e of calc ula tion s
o per ato r doe ope ran d may
ber of ope ran ds tha t the ope rato r use s (an y
doe s it cha nge the num prio r to exe cut ion ).
d by the ope rato r, tho ugh it will be eva lua ted
how eve r be ign ore · · u1t
s hort-c1rc · evaIuat1· on pro per ty.
"&& " and "II" ope rato rs Iose t h e1r
Ov erlo ade d
C# arie s wer e orig jnal ly
pm ent of the .NE T Fra mew ork , the clas s libr
Du ring the dev elo Ma nag ed C (SM C). In
ma nag ed cod e com pile r sys tem call ed Sim ple
wri tten usi ng a at the tim e
lsbe rg form ed a team to bui ld a new lang uag e
Jan uar y 1999, An der s Hej
like Obj ect Ori ent ed Lan gua ge" . Mic roso ft had
whi ch stoo d for "C-
cal led Coo l, the lang uag e, but cho se 1101
kee pin g the nam e "Co ol" as the final nam e of
con sid ere d licly ann oun ced
rea son s. By the tim e the .NE T pro ject was pub
to do so for trad em ark uag e had been ren ame d
200 0 Pro fess ion al Dev elo per s Con fere nce . the lang
at the July had been ported to C#.
arie s and AS P.N ET run tim e
C# . a nd the cla ss libr C# are :
g feature s of
not abl e dist ing uis hin
Som e mem ber s mu st be•
glo bal var iab les or functions . All met hod s and for
It has no public clas ses can sub stit ute
ses . Sta tic mem ber s of
dec lare d wit hin clas enc losi ng blo ck, unl ike C
fun ctio ns. Loc al var iabl es can not sha dow variables of the
global var iab les and
and
con fus ing by C+ + text s.
dow ing is ofte n considered
• C ++. Var iab le sha e con diti ons ,•
Boo lean data ty pe, bool. Sta tem ents that tak
C# sup por ts a stri ct imp lem ents the true
and if. req uire an exp ress ion of a typ e that
suc h as whi le a boolean typ e, it can
as the boo lean typ e. Wh ile C ++ also has
o per ato r. suc h such as if(a) req uire
ver ted to and from integers, and exp ress ion s
be free ly con C#
be an int, or a poi nte r.
tha t a is con ver tibl e to bool , allo win g a to gro und s that
onl y false" app roa ch, on the
this "int ege r mea nin g true or pre ven t
dis allows that return exa ctly boo l can
to use exp ress ion s
forc ing pro gra mm ers such as if (a = b)
com mo n pro gra mm ing mistak es in C or C+ +
cer tain typ es of of equ alit y = ).
men t = inst ead
( use of ass ign C# has a•
con stru ct to han dle exc epti ons .
to the try ... catc h blo ck.
In add itio n cod e in the finall y
ons tnic t to gua ran tee exe cuti on of the
try ... ti1118 II y C 77 rese rved ,vo rds .•
ver sion 4.0 ) has
c urre ntly (as of any •
C# a class can imp lem ent
are not sup por ted , alth oug h
Mu ltip le inh erit anc es by the lang uage's lead
Thi s was a des ign decis ion
num ber of inte rfac es. architec tural req uire me nts
com plic atio n and sim plify
arc hite ct to avo id
thro ugh out C U .

Common Type System (CTS)


mo n Typ e
tem . T his unif ied type system is call ed Com
Ct/ has a unified type sys inc luding pnm1t1ves s uch
fied typ e sys tem . imp lies that all typ es,
System (CT S). A uni a ToS tring()
Sys tem .Ob Jec t clas s. fo r exampl e, eve ry typ e inhe rits
the
as inte gers, are subc lasses o f
on
es (and value types in general) are internall y all oca ted
sons, primitive typ
method. For performance rea
1he stacf.. .

Categories of data types


o two categories:
CTS separate data types int
value types do
plain agg reg ati on s of data. Ins tances of
arc • equality and
I. Value types: they ere nti al comparison semantics
ty no r a ref
not have referential
identi a values within the
for value typ es compare the actual dat ived
inequality comparisons
era tor s are ov erload ed . Value types are der
corresponding op created and
instances, unless the a def aul t val ue, and can always be
always hav e from each
from System. ValueType, typ es are that they cannot derive
itations on val ue default
copied . Some other lim s) and cannot have an explicit
nt int erf ace
(but can impleme tive types, such as
other
Ex am ple s of val ue types are all primi
(parameterless) construct
or. (a 16-
(a 32 -bi t IEE E flo ating-point number), char
eger), float time with
int (a signed 32-bit int Da teT im e (id ent ifie s a specific point in
and Sy ste m.
bit Unicode code unit). and struct (user
her exa mp les are enum (enumerations)
Ot
nanosecond precision).
defined structures).
• each instance of
y hav e the not ion of referential identity data
2. Reference types: the ct fro m eve ry oth er instance, even if the
inherently distin inequality
a reference type 1s is is ref lec ted in default equality and
the sam e. Th
within both instances is than structural
typ es, wh ich tes t for referential rather
comparisons for refere
nce
tor s are ov erl oad ed (such as the case for
responding op era tance of a
equality. unless the cor not alw ays po ssi ble to create an ins
l, it is comparison on
System.String). In genera g ins tan ce. or perform a value
cop y an exi stin es by
reference type, nor to ic ref ere nce typ es can provide such servic
though spe cif (such as
two existing instances, im ple me nti ng a corresponding interface
structor or ject (the ultimate
exposing a public con ple s of reference types are ob
abl e). Ex am racters),
ICloneable or !Compar Sy ste m. Str ing (a string of Unicode cha
er C# classe s). s are extensible
base class for all oth all C# arr ays). Both type categorie
e cla ss for
and System.Array (a bas
with user-defined types.

ing language
lecture Note: Programm
t can be
langu age des igned to express computations tha
is an artificial d to create
A programming language pu ter . Pro gramm ing languages can be use
particularly a com precisely .
performed by a machine, ma chine an d/o r to express algorithms
behavi or of a
programs that control the and semantics
spl it into the two com ponents of syntax (form)n
A programming langu
age is usually the C programming
define d by a spe cifica tion document (for example,
are
(meaning). Some languages
ISO Standard), while
lan guage is specified by an

7
d as a refe rence.
Per l, hav e a dom ina nt imp lem ent atio n tha t is use
other languages, such as
Elements ks for the description
lang uag es hav e som e prim itiv e building bloc
All pro gra mm ing the additio n of two
pro ces ses or tran sfo rma tion s applied to the m (like
o f data and the primitives are defined
sel ect ion of an item from a collection). These
num ber s or the the ir stru ctu re and meani ng
ant ic rule s which describe
by syntactic and sem
respectively.
SYNTAX
tax. The syntax of a
gra mm ing lang uag e's surface form is known as its syn
A pro
tha t form a syntactically
uag e des crib es the possible combinations of symbols
lang symbols is handled by
aning given to a combination of
cor rec t pro gra m . The me Implementation).
al or hard-coded in a reference
semantics (eit her form
ation of regular
lang uag e syn tax is usually defined using a combin
Programming mm atical structure).
(for lexi cal stru ctu re) and Backus-Naur Form (for gra
expressions
Semantics as opposed to the ir form
to the meaning of languages,
The term semantics refers
(syntax).

Static semantics
or
valid texts tha t are hard
sem ant ics def ine s res tric tions on the structure of tic
The static ms .For compiled languages,
sta
to exp res s in standard syntactic formalis
imposs ible d at compile
ude tho se sem ant ic rules tha t can be checke
semantics essentially incl ore it is used (in
ude che ckin g tha t eve ry ide ntif ier is declared bef
tim e. Examples incl the arms of a case
req uire suc h dec lara tion s) or tha t the labels on
languages tha t this type, like checking
tha t
are dis tinc t. Ma ny imp orta nt restrictions of
sta tem ent ctio n
adding an Integer to a fun
use d in the app ropriate context (e.g. not
ide ntif iers are arguments,
call s hav e the app rop riate num ber and type of
name), or tha t subroutine tem . Oth er forms
def inin g the m as rules in a logic called a type sys
can be enforced by static semantics. Newer
s like dat a flow ana lysi s may also be par t of
of static analyse ignment analysis, a form
of
lang uag es like Jav a and C# have def init e ass
programming
ir static semantics.
data flow analysis, as par t of the

Dyn am ic semantics
form ope rati ons
spe cifie d, the ma chin e must be instructed to per
Once data has been by which expressions
exa mp le, the sem ant ics may define the strategy
on the data. For ctures con diti ona lly
valu es, or the ma nne r in which con trol stru
are evaluated to cution semantics) of a
ent s. The dyn am ic sem antics (also known as exe
exe cut e statem uage should produce a
s how and whe n the various constructs of a lang
language def ine ics. Na tural
are ma ny way s of defining execution semant
our . There
program beh avi exe cut ion semantics of languag
es com mo nly
en use d to spe cify the
language is oft
research wen t into form al
used in practice. Asignificant amo unt of academic
execution semantics to be
languages, which allow
semantics of prog ram ming limit ed
field of research have seen
specified in a form al man ner. Results from this .
and imp lem enta tion outside academia
application to prog ram ming language design
Gra mm ar
Lisp :
Below is a simple gram mar , based on

expression ::= atom I list

atom ::= num ber I symbol

num ber ::= [+-)7('0'- '9')+

symbol :: = ['A'-'Z"a '-'z'J .•

list ::= '(' expressi on• ')'


the follo wing :
gram mar specifies
This
ber or a sym bo l;•
or a list; An atom is eith er a num
An expr essio n is eithe r an atom dig its, optionally
ence o f one or more deci mal
A num ber is an unbr oken sequ more of any char acte rs
symbol is a lette r follo wed by zero or
prec eded by a plus or minu s sign ; A more expr essio ns inside
matched pair of parentheses, with zero or
(exc luding• whit espace); and A list is a
it.•

Syntactic am biguity
onab ly inter pret ed in
of sent ence s whic h may be reas
Syntactic ambigui ty 1s a prop erty than one thin g.
than one way . or reas onab ly interpreted to mea n mor e
more part s of spee ch or
invo lve one word having two
Amb igui ty ma) or may not
homonyms. words, but from
amb igui ty arise s not from the range of mea nings of sing le
Synt actic , and the sent ence
word s and clau ses of a sentence
the relations hip between the the sam e sent ence
a reader can reasonably inter pret
structure implied there by. Whe n l and meets the
ible structure , the text is equi voca
as having mor e than one poss
definition of synt actic amb igui ty.

Operator Precedence
d and reso lved in
an expressio n, each part is eval uate
When several operatio ns occu r in be used to over ride
ator prec eden ce. Pare ntheses can
a pred eterm ined orde r called oper evaluate d befo re
r of prec eden ce and forc e som e parts of an expr ession to be
the orde re thos e outs ide.
nthe ses are a lway s perf ormed befo
othe r part s. Ope ratio ns with in pare n expr essions cont ain
oper ator preceden ce is main tain ed . Whe
With in pare ntheses, how ever, norm a l son oper ator s are
mor e than one cate gol) . arith metic oper ator s are evaluate d first. com pari
operators from equa l prec eden ce;
next . and logi cal oper ator s are eval uated last. Com paris on oper ator s a ll have
e\ alua ted
that is. the} a~e evaluated in the left-to-right order in \-\ hich they appear. Arithmetic and logical operators
are evaluated 111 the following order of precedence:

Arithmetic Comparison Logical


Exponentiation (" ) Equality(=) Not
Negation (·) Inequality (o ) And
Multiplication and division (•, /) Less than (<) Or
Integer division {\) Greater than (>) Xor
Modulus arithmetic (Mod) Less than or equal to(<=) Eqv
Addition and subtraction(+,-) Greater than or equal to(>=) Imp
Stri~ concatenation(&) Is &

When multiplication and division occur together in an expression, each operation is


evaluated as it occurs from left to right. Likewise, when addition and subtraction
occur together in an expression, each operation is eva luated in order of appearance
from left to right.

The string concatenation operator (&) is not an arithmetic operator, but in precedence
it does fall after all arithmetic operators and before all comparison operators. The Is
operator is an object reference comparison operator. It does not compare objects or
their values; it checks only to determine if two object references refer to the same

object.
Parsing
In linguistics, parsing is the process of analyzing a text, made of a sequence of tokens
(for example, words), to determine its grammatical structure with respect to a given
(more or less) formal grammar. Parsing can also be used as a lingu istic term, especially in reference to
how phrases are divided up in garden path sentences.

Parser
In computing, a parser is one of the components in an interpreter or compiler, which
checks for correct syntax and builds a data structure (often some kind of parse tree,
abstract syntax tree or other hierarchical structure) implicit in the input tokens. The
parser often uses a separate lexical analyser to create tokens from the sequence of
input characters. Parsers may be programmed by hand or may be (semi-)automat ically
generated (in some programming languages) by a tool.

Overview of Process
. . . . ._ . . . . . J
:.-----1 "-ly . . .
Cer..1 1eT». e:ns)

Tok.~ •

Syn&a c:tic ~ s i s
(Crea te T,,..)

Ccllnp eler. ln11ar 1>r....-


or Tr.n ~tor

Types of parser
the input can be derived
The task of the parser is essentially to determine if and how
in essentially two ways:
from the start symbol of the grammar. This can be done
derivations of an
Top-down parsing- Top-down parsing can be viewed as an attempt to find leftmost
by searchin g for parse trees using a top-down•
input-stream
ed from left to
expansion of the given formal grammar rules. Tokens are consum
Inclusive choice is used to accommodate ambiguity by expanding all
right.
of grammar rules. Examples includes : Recursi ve
alremative right-hand-sides
LL parser (Left-to-right, Leftmos t derivation). and so on.
descent parser,
to rewrite it•
Bottom-up parsing - A parser can start with the input and attempt
to the start symbol. Intuitive ly. the parser attempts to locate the most basic
parsers are examples
element s. then the element s containing these, and so on. LR
1s Shift-Reduce
of bottom- up parsers. Another term used fo r this type of parser
parsing

II

You might also like