180 likes | 301 Views
3.1 Language Translators. Computing System Fundamentals. 'There wasn't no man nowhere so virtuous.” Geoffrey Chaucer, The Canterbury Tales Half a loaf is better than nothing. Nothing is better than a Rolls Royce. Therefore half a loaf is better than a Rolls Royce.
E N D
3.1 Language Translators Computing System Fundamentals
'There wasn't no man nowhere so virtuous.”Geoffrey Chaucer, The Canterbury Tales Half a loaf is better than nothing. Nothing is better than a Rolls Royce. Therefore half a loaf is better than a Rolls Royce. The gorilla eats shoots and leaves.The gorilla eats, shoots and leaves. 3.1.1 Syntax and Semantics
Syntax (grammar): each statement must be constructed correctly Semantics: each instruction must have a clear meaning 'I ain’t got no problems'- fairly clear semantics (meaning)- incorrect syntax (grammar) 3.1.1 Syntax and Semantics
Computers only run in machine code e.g. 0001010011100110 0001001100001111 1010001110101100 1001010000111011 Difficult for human programmers and prone to errors. A low level language. 3.1.2 High Level Languages
An improvement was assembly language: LDA 2905 ADD 1750 ...Load the number in memory location 2905... add it to the number in 1750... More understandable to humans, but needs another program to convert it to machine code. 3.1.2 High Level Languages
True high level code is more understandable: FOR X = 1 to 99 DO Y = X * X PRINT (X, Y) NEXT 3.1.2 High Level Languages
True high level languages are: portable (can be run on different machines) English-like (easier to understand) different, depending on their specific purpose. Examples are: BASIC, FORTRAN, Java. 3.1.2 High Level Languages
HL languages need a translator program to convert the programmer's source code into the computer's object code (machine code). Translators can be of two trypes: Interpreters Compilers 3.1.2 High Level Languages
Interpreters: Translate and execute line by line without saving object code Stop at the first error Need less memory Must be in memory while the program itself is running. 3.1.2 High Level Languages
Compilers: Produce a complete machine code program which can be stored on disc, loaded and run Need a complete source code program Give an error listing after compilation The object code product can be run on any machine (compiler no longer needed). 3.1.2 High Level Languages
Note that the syntax of an HL language source code must be correct or the translator (compiler or interpreter) will be unable to convert it into binary machine code. Semantic errors, however, will get through translation and must be corrected by the programmer. 3.1.2 High Level Languages
Tools that aid developer (not regarded as languages in their own right): Visual IDE's HTML Scripting languages DBMS's CASE Macros 3.1.3 Software Development Tools
Visual Integrated Development Environments (IDE's) are programs that allow software to be written, compiled, run and debugged in a user friendly way Usually have a text editor which highlights syntax errors, compiler, library of common routines, debugging help, GUI Examples: BlueJ, NetBeans. 3.1.3 Software Development Tools
Hypertext Markup Language (HTML) uses tags e.g. <H4>, </P> to control the display behaviour of other programs called browsers e.g. Firefox, IE. Not truly programming languages as authors do not have full control over the way their product is displayed. HTML editors e.g. Dreamweaver allow easier WYSIWYG (what you see is what you get) editing. 3.1.3 Software Development Tools
Scripting languages allow the insertion of short routines into other programs on a particular operating system e.g. VBScript for Office on Windows or AppleScript for Mac OS. JavaScript (not the same as Java!) supports HTML and makes web pages more dynamic. 3.1.3 Software Development Tools
Database Management Systems (DBMS's) provide interfaces which make database access simpler for users and developers. Hide internal structure of the database, manages the data dictionary (database structure, access rights, relationships between data items, etc.) and safety and security (schedules backups, controls access rights and sharing violations). 3.1.3 Software Development Tools
Computer Aided Software Engineering (CASE) involves techniques and software that help in the design cycle of a software product. Typical components help with: data flow diagrams, costing, scheduling tasks, documentation preparation, version control. 3.1.3 Software Development Tools
Macros allow common sets of tasks in general purpose packages e.g. Office to be recorded and re-used later. In fact they automatically write the code required in an appropriate HL language e.g. Visual Basic for Applications (VBA) in the case of Word or Excel. No knowledge of programming needed. 3.1.3 Software Development Tools