Unit 5 - Programming Languages PDF
Unit 5 - Programming Languages PDF
Unit 5 - Programming Languages PDF
10
15
20
25
30
35
40
45
50
55
60
65
70
The code can be read and written by a programmer. To run on a computer it must be converted into a machine readable form, a process called assembly The language is specific to a particular target machine or family of machines Some assembler languages provide a macro-facility enabling the development of complex patterns of machine instructions Second generation programming languages, originally just called high level programming languages were created to simplify the burden of programming by making its expression more like the normal mode of expression for thoughts used by the programmers. They were introduced in the late 1950s, with FORTRAN reflecting the needs of scientific programmers, ALGOL reflecting an attempt to produce an European / American standard view, and COBOL providing a natural language for developers of commercial software. The third generation languages emphasized: Expression of an algorithm in a way that was independent of the characteristics of the machine on which the algorithm would run The rise of strong typing (used to describe those situations where programming languages specify one or more restrictions on how operations involving values having different data types can be intermixed) Block structures (blocks which can be nested to any depth) and automated management of storage with a stack Broad-spectrum applicability and greatly extended functionality Generational classification of these languages was abandoned after the third generation languages, with the natural successors to the third generation languages being termed object-oriented. C gave rise to C++ and later to C#, LISP to CLOS, ADA to ADA 95 and even COBOL to COBOL 2002, and new languages like Java have emerged in that generation as well. But significantly different languages and systems were already being called fourth and fifth generation programming languages by language communities with special interests. The manner in which these generations have been put forward tends to differ in character from those of earlier generations, and they represent software points-of-view leading away from the mainstream.
75
I.
c. a multi-paradigm programming language encompassing imperative, functional, generic, object-oriented and component-oriented programming disciplines d. produced by Borland, it was formerly known as the Object Pascal Language; its most popular use is the development of desktop and enterprise database applications, but as a general purpose development tool it is capable of and used for most types of development projects e. a programming language that derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities; it is widely used from application software to web applications f. a computer programming language designed for multitasking and real-time programming; it supports both fixed-point and floating-point numeric values, character and character string data as well as bit values; it also provides facilities for structures and multi-dimensional arrays g. it is derived from BASIC and enables the rapid application development of graphical user interface applications, access to databases using Data Access Objects, Remote Data Objects or ActiveX controls and objects h. a set of rules for encoding documents in machine-readable form; its design goals emphasize simplicity, generality and usability over the Internet i. a scripting language developed by Adobe, used primarily for the development of websites and software targeting the Adobe Flash Player platform j. short for Laboratory Virtual Instrumentation Engineering Workbench; it is also referred to as G and used for data acquisition, instrument control and industrial automation k. a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems l. designed by Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications m. one of the earliest programming languages; it pioneered many ideas in computer science, including tree data structures, automatic storage management, dynamic typing and the self-hosting compiler; linked lists are one of this programming languages major data structures and its source code is itself made up of lists n. a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language; this language began as enhancements to C, first adding classes, then virtual functions, operator overloading, multiple inheritance, templates, and exception handling among other features o. it allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces and interfacing with programs written in other languages, including C, C++ and Fortran.
Linux ran primarily on x86 based PCs, and it actually ran pretty well even on a slow 386 with 4 Mb of RAM and a 40 Mb hard disk. Linus and his followers proudly described Linux as a 5) .. (a programmers system) because it relied heavily on freely 6) which had been written by other 7) . Its 8) was the X Window System, which was freely available from MIT. For its GUI it used a collection of freely available window managers and other GUI components, as well as the Athena and OpenLook styles, which were also freely available. Because of its 9) , some 10) even began to sell versions of Motif for Linux. Most of the other programs which people actually used (the shells, the compilers, the utility commands, etc.) came from the GNU Project a free software 11) started by Richard Stallman in the 1980s. Stallman was a talented programmer, but he was also a little 12) . He passionately believed that all software should be free and should come with 13) so that other programmers could extend it, and that computing professionals should only make money through 14) . The ultimate goal of the GNU Project was to create a completely free UNIX-like operating system called GNU.
interpretate: instruciunile sunt citite linie cu linie de un program numit interpretor i traduse n instruciuni main; avantaj: simplitate; dezavantaj: vitez de execuie redus; compilate: codul surs al programelor este transformat de compilator ntr-un cod ce poate fi executat direct de procesor; avantaj: execuie rapid; dezavantaj: lipsa portabilitii, codul compilat ntr-un format de nivel sczut nu poate fi rulat dect pe platforma pe care a fost compilat. Programele Java sunt att interpretate ct i compilate. Codul de octei este diferit de codul main. Codul main este reprezentat de o succesiune de 0 si 1; codurile de octei sunt seturi de instruciuni care seamn cu codul scris n limbaj de asamblare. Codul main este executat direct de ctre procesor i poate fi folosit numai pe platforma pe care a fost creat; codul de octei este interpretat de mediul Java i de aceea poate fi rulat pe orice platform care folosete mediul de execuie Java. b) Nivelulunui limbaj este apreciat prin poziia pe care o ocup pe scara constituit de limbajul recunoscut de microprocesor (limbaj main) i limbajul natural al programatorului (limba romn, limba englez etc.). Un limbaj de nivel sczut este foarte apropiat de main, el manipuleaz cu elemente de nivel hardware, fizic, cum ar fi: registru, microprocesor, locaie de memorie, port de intrare/ieire etc. Un limbaj de nivel nalt sau foarte nalt manipuleaz cu concepte apropiate de limbajul natural, concepte de nivel logic, cum ar fi: colecie de date, nume de operaie (sort, writeln, open), variabile, constante (asemntoare ca neles cu cele din matematic). Cu ajutorul unui limbaj de nivel nalt programatorul se face mult mai uor neles de ctre calculator . Uneori o singur linie de program scris cu un astfel de limbaj poate echivala cu sute de linii de program scrise n limbaj main. Deci din punct de vedere al reducerii timpului de realizare al unui program i al siguranei n funcionare (absena erorilor de programare) este de preferat un limbaj de nivel ct mai ridicat (nalt sau foarte nalt). n schimb, pe msur ce limbajul are un nivel mai ridicat execuia programului conceput cu ajutorul su va fi mai lent, dect a unui program ce realizeaz aceleai operaii dar este scris n limbaj de asamblare. O alt diferen esenial ntre cele dou tipuri de limbaje o reprezint portabilitatea, adic posibilitatea transferrii programelor pe un alt tip de main dect cea pe care au fost construite. Din acest punct de vedere limbajul de asamblare este neportabil deoarece el este specific microprocesorului. Programele realizate pe un tip de main trebuie rescrise integral pentru noul tip de main, folosind un nou set de instruciuni care, de obicei, difer foarte mult. Lucrurile stau altfel cu programele concepute cu ajutorul unui limbaj de nivel nalt, deoarece acestea sunt detaate de main. ntre un astfel de program i calculator se interpune compilatorul (sau interpretorul) care rezolv corect transformarea fiierului-surs n fiier-executabil. Limbaje procedurale neprocedurale Cele dou tipuri de limbaje, procedurale i neprocedurale, se difereniaz prin nivelul de organizare (structurare) a unui program . Limbajele neprocedurale sunt concepute pentru a gndi un program la nivel de instruciune, pe cnd cele procedurale, oblig programatorul s conceap programe la nivel de bloc. ntr-un limbaj procedural 6
(numit i limbaj structurat), programele sunt scrise instruciune cu instruciune, dar ele sunt organizate logic n blocuri (grupuri de instruciuni) ce realizeaz o aciune bine determinat. n general un bloc are un punct de intrare i un punct de ieire nu mai multe. Un limbaj procedural ofer posibilitatea utilizrii unui nivel ridicat de concepere a unui program i duce la realizarea de programe coerente i protejate la erori. Prin contrast, limbajele neprocedurale nu favorizeaz programatorul n a se desprinde de nivelul instruciune i duc deseori la programe greu de controlat mai ales n cazul programelor de dimensiuni mari. Limbajele neprocedurale sunt nc preferate de unii utilizatori datorit timpului foarte scurt ct decurge nvarea i utilizarea lor. Limbaje orientate Din punctul de vedere al aplicabilitii unui limbaj, limbajele pot fi orientate pe o anumit problem sau concepute pentru soluionarea oricrui tip de problem limbaje de uz general sau altfel spus, neorientate pe o problem. Limbajele orientate prezint un grad nalt de specificitate pe cnd un limbaj neorientat reprezint un cadru general ce permite introducerea de ctre utilizator a conceptelor i prelucrrilor dorite. Deci, diferena esenial dintre cele dou tipuri de limbaje o constituie nivelul conceptual definit. Cele specializate posed deja integral suportul necesar i permit programatorului s se concentreze la ansamblul problemei, pe cnd cele nespecializate las n sarcina programatorului manevrarea nivelelor inferioare ale problemei. Limbaje concurente Un limbaj concurent permite definirea de procese (prelucrri) paralele, execuia sa fiind ramificat la un anumit moment de timp. Prin contrast, limbajele neconcurente (majoritatea limbajelor) au o desfurare liniar, fiind activ un singur proces la un moment dat. Procesele concurente presupun n mod obligatoriu un sistem multi-tasking ce poate gestiona mai multe sarcini la un moment dat. Limbaje de nivel sczut Aceast categorie de limbaje are un reprezentant autoritar i anume: limbajul de asamblare. Diferenierile care se pot face pentru limbajele de nivel sczut sunt urmtoarele: a) dup tipul de main ; Regulile respectate de versiunile limbajului de asamblare sunt: - o nou versiune o include complet pe cea anterioar , - versiunea nou ofer funcii suplimentare i le realizeaz pe cele vechi mai rapid . b) dup mediul de programare oferit. Aspectul unui limbaj poate fi schimbat radical de mediul de programare oferit. Pentru limbajul de asamblare exist mai multe implementri disponibile, ncepnd cu pachete ce opereaz n mod linie i culminnd cu medii integrate n care toate operaiile se pot declana de la un acelai pupitru de comand. Nu sunt luate n considerare dect aceste medii integrate( denumite generic medii Turbo), dintre care se detaeaz Turbo Asamblorul firmei Borland TASM.
Adverbs are those parts of speech that modify or add to the meaning of verbs, adjectives, other adverbs, prepositional phrases, complete sentences or even nouns modifying: A verb: Kerry sang that song beautifully. An adjective: The problem was extremely difficult. An adverb: Mary understood us very well. A prepositional phrase: Her watch was completely out of order. A complete sentence: Strangely enough, she left without saying a word. A noun: The girl over there is my sister. Forms of adverbs Individual words: here, soon, then, when Compound words: 1. made up of two different parts of speech: abroad, anywhere 2. made up of an adjective/noun + the suffix ly: badly, hourly a. adjectives ending in e, retain e and then ly is added: extreme extremely; nice nicely b. adjectives ending in le drop e and add y in the adverb: capable capably; gentle gently c. adjectives ending in l preceded by a vowel, retain l and add ly: final finally; usual usually d. adjectives ending in ll just add y: full fully; dull dully e. adjectives ending in y change y to I and then add ly: easyeasily; happy happily Sometimes, the ly adverbs have a different meaning from their corresponding adjectives. CLOSE quite, near; CLOSELY descriptive use e.g.: He came close to getting 100%. This girl resembles her mother closely. DEEP far down or into (it may be used either literally or figuratively); DEEPLY very greatly (used metaphorically of degree) e.g.: He went deep into the woods. She felt his betrayal deeply. FREE without payment; FREELY in a free manner or Willingly, readily e.g.: It cost me nothing. It was free. I feel that I can speak freely. (without hiding anything; openly) HARD with great effort/great force, with great attention; HARDLY almost no/not/none/never etc., probably not
e.g.: You have worked very hard. We can hardly walk. HIGH at a great distance from groundlevel, sea-level etc.; HIGHLY very much, with approval e.g.: The plane was flying high in the sky. He speaks very highly of you. JUST exactly/precisely, very recently; JUSTLY in a fair or reasonable manner e.g.: Our friends have just arrived. She was quite justly blamed for the accident. LATE after the expected or usual time, far into the day or night; LATELY recently e.g.: He arrived late for the interview. Have you met them lately? RIGHT exactly, immediately, completely, correctly; RIGHTLY accurately e.g.: I waited for her right here. They rightly assumed that he was guilty. SHARP punctually, abruptly, quickly; SHARPLY in a sharp manner, distinctly e.g.: We left the club at 11 oclock sharp. Opinions are sharply divided on this matter. Types of adverbs Adverbs of manner Adverbs of place Adverbs of time Adverbs of degree Irregular comparison of adverbs well badly far far The position of adverbs When a sentence contains more than one kind of adverb, the usual order should be: Manner place time better worse further farther best worst furthest farthest
EXERCISES I. Replace each adjective with an adverb: e.g.: boastful boastfully 1. The ballerina moved around very . (graceful) 2. David (easy) won the first race. 3. I dont know (exact) how much money he makes. 4. I (honest) dont know what John told his sister. 5. The singer of the band sang very (bad) during the concert. 6. My friend Tom always speaks very . (loud) 7. You speak English very . (good) 8. These days I am so busy at work that I (rare) have time to go out. 9. Sometimes I like to spend the day just lying in bed . (lazy) 10. The police officer made sure that she got home . (safe) II. Each sentence has an underlined word. Your task is to decide whether the word is an adverb or an adjective: 1. Be careful! The iron is very hot. 2. A microwave can cook food fast. 3. June sang very loudly. 4. This bacon is lovely. 5. Joe dresses very informally. 6. Shes a very strange woman. 7. Im free tomorrow. Shall we meet at 5? 8. Jane is very helpful if you have a problem with your computer. 9. Sam walks very shakily, because hes getting old. 10. I get up early every morning. 11. It is a fast car. 12. He is a better swimmer than me. 13. He reached deep into his pockets. 14. He swims better than me. 15. He works hard. 16. We found the people friendly. 17. He drove some of them mad. 18. This made everyone late. 19. We shall leave the room empty. 20. He turned the corner well. III. For each sentence, choose the best word or phrase to complete the gap from the choices below: 1. Thanks for the weekend. We had a wonderful time. 2. The weather at the beach on Saturday was gorgeous. 3. Try that restaurant. The food is marvelous.
10
4. I was .. annoyed when he said that. 5. He told me a/an unbelievable story. 6. You probably feel quite cold today but actually, fifteen degrees is .. hot for England in October. 7. What they told the police was untrue. 8. Both sisters were brilliant students. 9. Thats a wonderful ring. It must have been expensive. 10. I need to sit by the fire. Im freezing! 11. That cheap umbrella I bought was useless. It broke the first time I used it. 12. Youre talking rubbish! Of course I dont believe you! 1. a) so 2. a) such 3. a) such 4. a) much 5. a) completely 6. a) simply 7. a) extremely 8. a) relatively 9. a) really 10. a) rather 11) a) very 12) a) rather b) such b) extremely b) very b) absolutely b) extremely b) pretty b) very b) totally b) absolutely b) wholly b) fully b) extreme c) very c) absolutely c) terribly c) totally c) nearly c) completely c) totally c) almost c) simply c) absolutely c) utterly c) quite d) absolutely d) awfully d) simply d) extremely d) very d) absolutely d)rather d) wholly d) totally d) very d) extremely d) absolute
11