gg-7 - Programming Programming Environments and Translation...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Programming Programming Environments and Translation Methods Fundamentals for Users R: 4­5­07 Outline Language type used in this class 2. Language translation approaches 3. Error types 4. Error finding methods 1. 2 1. Language used in this Class Visual Basic for Applications (VBA) – Scripting Language for MS Excel – Creates Event­Driven programs (Scripts) Attach code to Objects – E.g., button Application triggered by events – Interpreted – Interpreter installed with MS Excel 3 – E.g., Button click Why Translate? Convenient high­level languages Machines run machine­level language Requires translation Traditional compilers are specific to CPU – Source code programs – Script language statements type (architecture) 4 2. There are Three Fundamental Translation Approaches Compiler Interpreter Two­Step Approach 5 Compiler Compiler translates high­level program to machine­level program. – Translate once, run many – Outcome: machine language instructions in the form of .EXE and .DLLs – Fast because machine runs machine code and doesn’t have to translate at run time. – Must install machine­level program on user’s machine before program runs 6 Interpreter Interpreter converts code to machine language statement­by­statement just before execution. Discards commands when they are no longer needed Translation done every time Slower because it must translate for every use 7 Translation Methods Comparison 2­Level High­level Compiler Mostly­ translated JVM or CLR Machine level Classic Compiled High­level Compiler Machine level Interpreted Script Interpreter Machine level 8 Translation Methods Type Classic Compiled Interpreted 2­Level Examples How Pascal, C+ Whole Program + HTML, statement­by­ Java Script, statement VBA Java, Whole Program; Visual then statement­by­ Basic.Net statement 9 Java: 2­Level Approach Java Code High­Level­ language program JVMs are in the computer’s browser Compiler bytecode Mostly­ Translated Program Mac JVM Machine code PC JVM Machine code Mac PC 10 10 Creation and Use of Java Applets 11 11 Compiled into bytecode Stored as a separate file Referenced using the <applet> or <object> tags JVM in browser Java Applet Interpreted at run time Entire script embedded in html document Identified by the <script> HTML tag JavaScript JavaScript Interpreter in browser Programmed with Java JavaScript statements Programming tools added directly into HTML document 12 12 Pros and Cons of Scripts & Applets Client Application: Web Browser with interpreter or JVM Advantages – Easy updates on server Scripts and Applets distributed from server to client at run­ time Platform independence Disadvantages – Slower performance – Internet bandwidth constrains performance – Applets not permitted through some firewalls 13 13 3. Types of Errors Syntax Error Run­time Error – Incorrect use of language’s defined set of key terms and operators – Compiler or interpreter usually catches – Found when running – Logic errors – Compiler typically doesn’t catch 14 14 4. Methods for Error Detection Visual Code Examination Debugger Step­through Test Cases – Developed independently of program – Known correct input/output combinations 15 15 ...
View Full Document

This note was uploaded on 04/07/2011 for the course ISYS 200 taught by Professor Dean during the Winter '11 term at BYU.

Ask a homework question - tutors are online