0% found this document useful (0 votes)
13 views5 pages

PPL Assignment 1 Arnav Sharma

The document discusses the process of language translation, detailing various phases such as lexical analysis, syntactic analysis, and semantic analysis, culminating in code generation. It contrasts formal translation models, which prioritize grammatical structure, with dynamic equivalence models that focus on meaning and cultural appropriateness. Additionally, it touches on concepts related to grammar, attributes, and pointer arithmetic in programming languages.

Uploaded by

pprakriti901
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

PPL Assignment 1 Arnav Sharma

The document discusses the process of language translation, detailing various phases such as lexical analysis, syntactic analysis, and semantic analysis, culminating in code generation. It contrasts formal translation models, which prioritize grammatical structure, with dynamic equivalence models that focus on meaning and cultural appropriateness. Additionally, it touches on concepts related to grammar, attributes, and pointer arithmetic in programming languages.

Uploaded by

pprakriti901
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Name'

Asciqnwmemt-1
Axnay Shasma ENo-02g18002?2 seclcer - B|6
Secllen.
subject:- riiple o Rogumig langaag Coo CLE -320 .

Aues-l Disw n delcul diffeut stgu in languag trautlcdan


H-language treudatisn wole done by comptl
Cemplation proce is diided ito à sewes ot sub-proce rallec
PROea Apha i logically cohee opetaien tht 7adee as nput
éne representatian ot one progran e produca as output.
>Frst Phan Leviecd anayze):- Thie the nt pho te
Cenylatuon proces. ynhi the pointen scancs the chauade and
Conveud those chauateuinto lekemes The combinao ot
hiple lexemee resulti in the token, hfoh Pe tthped
into mext phuye.
>Se concd Pha (Synacie Analyzen).- The tolcens creatd by the
Lexteod ancy Ps an aput
toole cuy an n thi phaue, n
the Symtactie"anaye,take
cau y the syday and checke il.
amel J t follouc the Sules. then it genertda puse
tree out e it
3) Third phaw (Semaic Analyze) The pase tree took an
Tnput, and convet the pase tree fnto imjplen expreyies
Sueh au three- addves -cod
4) fonth Pha (9 utemeda1 Cocu Generaio u): Th e fe the te
pha the wompilcan Proces, in thfs the Ratenmedat
Code genertd, The 3-Ac repredas Quaduplex iple
and hdiret Triples. Thew
Th chowd be ctteant ottenenti
5) Afth hase CCode ophmi galon)- h an
ophona
to inn prove the intearmedctu Cole So thot
phase
desgn and taker le Cpae .
pogram
AXGxth ph (Code Codde
eneaen-Sn inal phase at codegui
procue the object by deaiding en meumoyy loccou oy
nta, seleching code and selechin segister n oheh eaclh
Cornplouton done
Quer-a ompa the forsmal tranlahÝy witth oHhen
tranlauon model
Ans.- A"foradtroulahion model" priorit iz lorely mivrori
the sonee languag's grammetical atudud and lexia
choices aiming
meddegtect the
fox
fox a" trapt" traulatL`n that
the oriqinal text, while othen translatiou aQ
model,lik"dynae oquvalun" modeli ,pniovih nadue
in the taugit
language sonetimes deviatung om thegouaca
text'e eract oording to acheive battin readabiliy l culual
ppropriatuneu.
Key diffesn
1>Fomcal Translationa.Q Mode0
)focu on chrutuw.- fomal tranlahon models strin to matain
the original sentenee shrucie,veb tenses and wovd
Ordea as docely a possible
5) Lextcad Adelity - The otten aim to we the closet
the
equivalt ord in the tugt languag ,even ît am
a moYe
Cowmon or idiomatie choice exist.
9)0the Troulatonal odel
a) Dyramie equivalen e todti- Priorihg convegny the mocning
and ptended ofect ot the cowL Unt nauway thet
natuel and cultuely appro priatu for the tange audieuce,
enit it mecns otteg' tae oordgy sigutty.
b) funchionel eqwvalena model!- focuw en the. fiunduo ox
puposes of he ext in the eugt c l e jadaphint tw
, to tt the intended conuxt and cudieuc
rauslahon
Que-3 Diseun alwbut qrawmer and
explun
An'- Atribi rommen
An attibut
been extended 9rammer
îs a conit-ree gravnn en th
to pyodi Con
PPendng cai butu to Some oxt-cewuihve iutomo by
ts non-term înae.
cach dishnct synbol the grammen hes
itt afhpossiby empty et of atibit. awoali with d
*S-ttibut Graw men.
Syutheiud Grammer
"S enantic odbu
placed owy to the end, ot prduia
*Bottom-
Examples
up-paing
then A.s tCBs ,c-s, D.S) == vaue ot A deuvivg tror
chld ottibut ony
Gramnmen used
wsed Synthefzd value thetoxe they cud i - t
gsammen
. tatribut Gramnw
. Syuthe'd and lnheited Cpant 2 let i8llug ouly) att6.
Senanti'e acho ploud ny he oudw.
" let to Riqht, Bottum up pasing
Excunples
1. A y2
y.s= A.S;

L-aibt beccew -dees


Above gamm en
the Lt
trom paut and sibling to tt
valw eudy
R va and
jad
Poinlea'c ahntic t ole ot L-valw oud- R- value ih

Hn--vae
ident hable temrnenly denole
-
(i
memo g loccln
e one with an add ve) Ther te m

"-vau
idConteutat
descbey a
objot. An auy
meoy locain that fe wwd tu
Aype
with the
hibti fs al Prohioite foy chcungeble
lvalue n Poinlea agithmee
y
" Nemo Sin c an L- value nes a me
addreu relene portu
addre,it can be cunid ic an L- vole
" Poiwtm Incrent Decrewwt' \when c Poiuter
locoien.
Tt can be moci ied to point noth en memog
to ctes oY moci
pointey
Deceencng (" ph)lvalue all ouosaddve
the valshored at a meno
Ex: nt mainl)
int X= \0 on L- y a e
int tpr Rn devefeed
| vaid bercecc t p
*ptr = 20j
cout <prj
seluyno,
3.
vae thot doe not
# R-Valui- A-R- vae tenpor fe a
have a spe cit'c menet localien and cannot be angd.
Pointe Arithmetie
Role in
Pointer anthmie openahioy lilke v+|
.n4dreu Compwaion):
n R-vau
pdue
Expreuon- Adding an ategen to derelenud
Tasmp orcuy an R- valrC*phr).
.inter givei

10,20, 363,
t amC1=*
int pr asY
nt y= *(phrt)*lphrt) is an R vae
Cx>lo) ?-
y= Eruple
.
-op.(relahoncl thmetie) (cui
prewe]END
Openetox. Bincy coitn anige fograph
s Sttav
symbols and A
vicually grcuph . gtav
GaA
uin ruler repreuth
Ascigument: fox Graph Syatav O)
be. =Lnum (Comtat>: (Vauiable
ferlideuh =
|")=""">"|
"4= ..onol-op:"==
"*w"/" |"_"| +"
<expreoy| <relahonal-op KanignmeKaaiKexprn-to:=:pt?hmeheeion)
exprenion>canithmetic-op
<expreiony <vaiables =
cexprenons "
egralning
languaeu
wing
roouchion
su tormal fc
aFom)
nolatiou Dpelt back
aibe towndAssignmeat foNotahon
r 1)GNE
binauy wny
aional euithmec
ond et
SNF the Disw
Sytay andnolatuoy
Grapha
to

You might also like