when an argument is a reference to an object, a copy of that reference is passed. (This is not by reference parameter passing.) Translation and Execution C (PL/I has the same steps) This topic is frequently known as compilation Preprocessor translates #include, #define, vs interpretation. #ifndef directives into their corresponding C code Many traditional languages (COBOL, Compiler generates appropriate assembly FORTRAN, PL/I, C) have most of these steps language (depending on hardware and in translation: operating system) Preprocess - converts Assembler generates machine code Linker resolves external references (e.g., preprocessor directives global extern references to global extern to source language function calls to the address of those statements functions) Compile - generates assembly language from the source LISP language code No preprocessor, compiler, assembler, linker Assemble - generates machine Interpreted at runtime from a prefix syntax instructions for the using a LISP Virtual Machine assembly language statements Java Link - resolves external references No preprocessor Compiler generates appropriate bytecodes to create an executable (non-architecture specific assembly-like language) Another approach is to do all Bytecodes are interpreted at runtime a translation/execution at runtime. With Java Virtual Machine interpretation, the language is quickly parsed When necessary for performance, some and executed instead of having formal implementations will translate to machine compilation steps prior to execution. code prior to execution or dynamically during execution Java uses a hybrid of compilation and interpretation. Operations and Sequence Control Infix notation: These provide the essential framework perimeter = 2 * width + 2 * length; // rectangle within which operations and data are perimeter = l1 + l2 + l3 + l4; combined. // four-sided polygon Some characteristics of operations: What are some shortcomings of notation? syntax notation (prefix, infix) ?? precedence How would we represent a substring operation which extensibility requires 3 operands (string, start, length)? number of operands ?? explicit vs implicit operations explicit vs implicit operands Prefix notation in LISP: explicit vs implicit results (+ (* 2 width) (* 2 length)) invariant vs generic (+ l1 l2 l3 l4)
when an argument is a reference to an object, a copy of that reference is passed. (This is not by reference parameter passing.) Translation and Execution This topic is frequently known as compilation vs interpretation. Many traditional languages (COBOL, FORTRAN, PL/I, C) have most of these steps in translation: Preprocess - converts preprocessor directives to source language statements Compile - generates assembly language from the source language code Assemble - generates machine instructions for the assembly language statements Link - resolves external references to create an executable Another approach is to do all translation/execution at runtime. With interpretation, the language is quickly parsed and executed instead of having formal compilation steps prior to execution. Java uses a hybrid of compilation and interpretation. C (PL/I has the same steps) Preprocessor translates #include, #define, #ifndef directives into their corresponding C code Compiler generates appropriate assembly language (depending on hardware and operating system) Assembler generates machine code Linker resolves external references (e.g., global extern references to global extern function calls to the address of those functions) LISP No preprocessor, compiler, assembler, linker Interpreted at runtime from a prefix syntax using a LISP Virtual Machine Java No preprocessor Compiler generates appropriate bytecodes (non-architecture specific assembly-like language) Bytecodes are interpreted at runtime a Java Virtual Machine When necessary for performance, some implementations will translate to machine code prior to execution or dynamically during execution Operations and Sequence Control These provide the essential framework within which operations and data are combined. Some characteristics of operations: syntax notation (prefix, infix) precedence extensibility number of operands explicit vs implicit operations explicit vs implicit operands explicit vs implicit results invariant vs generic Infix notation: perimeter = 2 * width + 2 * length; // rectangle perimeter = l1 + l2 + l3 + l4; // four-sided polygon What are some shortcomings of notation? ?? How would we represent a substring operation which requires 3 operands (string, start, length)? ?? Prefix notation in LISP: (+ (* 2 width) (* 2 length)) (+ l1 l2 l3 l4)
cs3723OverviewWO.docx