0 valutazioniIl 0% ha trovato utile questo documento (0 voti)
20 visualizzazioni3 pagine
Assembler, Compiler, Interpretor
Il documento spiega il concetto di architettura von Neumann e come i programmi siano rappresentati come codici binari in memoria. Viene discusso il ruolo dei traduttori, come assemblatori e compilatori, che convertono il codice sorgente in codice macchina eseguibile dalla CPU. Infine, viene evidenziato il confronto tra compilatori e interpreti, con i rispettivi vantaggi e svantaggi nella traduzione e nell'esecuzione del codice.
Per noi i diritti sui contenuti sono una cosa seria. Se sospetti che questo contenuto sia tuo, rivendicalo qui.
Formati disponibili
Scarica in formato PDF o leggi online su Scribd
0 valutazioniIl 0% ha trovato utile questo documento (0 voti)
20 visualizzazioni3 pagine
Assembler, Compiler, Interpretor
Il documento spiega il concetto di architettura von Neumann e come i programmi siano rappresentati come codici binari in memoria. Viene discusso il ruolo dei traduttori, come assemblatori e compilatori, che convertono il codice sorgente in codice macchina eseguibile dalla CPU. Infine, viene evidenziato il confronto tra compilatori e interpreti, con i rispettivi vantaggi e svantaggi nella traduzione e nell'esecuzione del codice.
Per noi i diritti sui contenuti sono una cosa seria. Se sospetti che questo contenuto sia tuo, rivendicalo qui.
Formati disponibili
Scarica in formato PDF o leggi online su Scribd
Sei sulla pagina 1/ 3
Pere
eel ‘You leamed eartier that a von Neumann architecture computer uses the
stored program concept. The instructions that the computer carries out, the
program, are stored in memory just like any other kind of data. This means that
[programs are also just binary numbers ~ that's all you can store in memory. So
how can binary numbers represent a program?
(One other thing you learned is that the CPU can only do a few simple things.
It only ‘understands’ a few very simple instructions. Complex things like
playing games are possible because a really large number of those simple
things happen very fast. Those few simple instructions that a CPU knows how
to do are called the instruction set for that type of CPU. Each instruction is
given a binary code. I is these codes that make up your programs. The binary
Tatrcogon aot ta lata pol Codes representing a program are called machine code.
‘commands a particular CPU knows how to A machine code program would look something like the diagram below. You
carry out can probably see why programming in machine code would be completely
machine code the binary codes impractical,
representing each of the instructions inthe
instrection set
‘translator a program that converts
ee ee ae ‘a Figure 4.17 An example of a machine code rogram
‘source code the texto the program
‘hat a programmer wits Not only would it be incredibly cfficuit to work out the sequence of 1s and Os
‘assembler translates the mnemonics of you need, but also your program would only work on that kind of CPU. This
‘assembly language programs into machine _is because different CPUs have different instruction sets. Instead, you need
Fanguage instructions for the a translator which converts your programs into the CPU's machine code
‘microprocessor to cary out language.
assembly language a lowevel 7 = this i
ae Cea arena ‘Translators are also programs. Their input is the text of your program ~ this is
called your source code. Their output is machine code which the CPU can
low-level programming language run (execute).
a programming anguage tatis closely
related tothe CPU's machine code ‘The simplest translators called an assembler. It converts assembly language to
machine code. Assembly language is called a low-level programming language.mnemonic asfer inl actnyn et
{oprecarts oat fhe rections 2
‘GUS stucon set 20 DA Gras
‘agsin, STR(6o>) are CHP Earp)
“omulstor Pox oor tat
‘lbs oe peo eonaut ast to
teaver
‘reboot san dese agan etm
fhe computer rt ton ain
level of he CPU harsrare faa Each suction my assamoy langage is
same asa mache code instruction,
‘Assembly language is a bit easier to work wih than machine code bacause
foam retucton & writen asa shot, memorable kayword calea 2 mnemone
For exaroe, the instruction fo the GPU to add numbers toaeher might
ba Or1DI00" in machina cogs buts ust ln assert anguage. Tr
assembler replaces oach mnemonic wih the aporoprite binary machine code
snd daa Heros an enaiple of asiomsy cre:
om Rs; f=)
wav Re, 4
cur RS, 3
WOVOr BE, 42
‘0 YoU KNOW?
‘The 180s spaos-radng gare Eta, wich featured 3D graphics anda gay of
hundreds of lana to expo, was wnt ene in asemay language and
‘scupied jst 2 KB, To undestan how amazing that programming was, ok
ate fe 80 of amocer 30 graphics gama ofeam more, you ee pay an
utente vrsion ofthe game cn an emulator. Search onto fr BoobEn!
ering programs in assem language is chatenging for tres reson.
18 Aver tried ange of instuctions is avatable, Every task even the
‘mplit. no te be bult up fom the males eps. Some our CPUS
(ould not even multi numbers
1= Yourave to manage al your data. Ther ae no stings, intogers or ra
‘umbers, jst inary, s0 you have to dacide how to ecresert your Seta.
‘ou sso nave to ascide and manage where tls stared n meron.
18 Debuzoing 6 ver aifeut von the assembled program runs, ary bugs
st make te machine ras and yau have to reboot 10 Wy aga.
Nowadays alnost re prorans re wren in assembly language. The
secaptens aro some haroare onvers an programs ees tO co
embedded ayatoms that you leaned about eae nthe chapter. Ths is
bbacatse writing the CPU's home langage canbe Useful f you wart your
progam tobe very small and very fat ore rectly contol tho /O hardware.20 PROGRANMING LANGUAGES
EID = re nore common to vite sotware in righieve programming
languages suchas Python, Ci, Java o° Visual Base Fo tesa programs to run
cn te CPU, he source code has to be transac nto machine code. This can
‘compiler arab comers
‘ig teveltrgage source cde to
jet cate, ote mci. The
snr cle ranted at ocean
‘ae te eect tar
Intorproter a vnsar that cavers
igh-ovellnguage source cx ito
‘hjet cat, tien meine cad. Tho
‘eared tnd rd ctedont
Tost tine
object cox ne arsed sou cate
‘en msl te nacre coe but mit
‘aso ween nba cox, wie 210
‘eet before can
cowcutne
Table 4.3 Usin campers rete
bbe done alla once, ana the tished machine cade program raved and run
Inter, one ne at a ene,
‘COMPILERS AND INTERPRETERS
‘Aranslator thal translates the whole prograrn in one gos cated a compiler.
A translator that ranslates aru your Erograrn one Ine at atime scaled
an interpreter.
‘compiler converte hig lvel language to rachine code and eavee the
cutput as amachine code program, comtimes calod abjest coda. Th
‘cual has tho exo fle oxtencion shot fr ‘executable, becaute the machine
(cece can bs exaeutod crn
‘An nterpreter translates your source code one line ata ine then runs it There
sno obiect cove fl, only your orignal source code.
ona Coed
Every computer that wilrun your The output from a comple lun
program needs the inierreter on ts own on any simlar comput
Software rstaled.
Irtorproters find ners when they Accampiler cannot precuce any
hhappenand.canofentellyou object code uniess the mbele
vwrat has gone wrong. program is corect=they fend to
fenorta tof ero inal, making
‘harder to debug your rogram.
Programs tond to rua slower {canbe easier to protoct your code
Using an interpreter because the from being aero or copies thas
interpreter has to translate the beer compled because you only
source cade whle the programs give peop the ctject code (machine
running. ode), which shar to understand.