Shared Flashcard Set

Details

Final Exam
Study Guide
54
Computer Science
Undergraduate 2
05/09/2017

Additional Computer Science Flashcards

 


 

Cards

Term
Lexical Rules
Definition
A type of syntax rule to check the validity of a program. Defines the alphabet, words, and language of a program
Term
BNF
Definition

Terminals: encloed in double quotes, such as "a", "+", "begin"

Nonterminals: enclosed in "<" and ">", such as "prog"

Production Rules: A single nonterminal, followed by "::=", followed by a sequence of terminals and nonterminals

MetaSymbols: "+": One or more occurrences of the previous element; "*": Zero or more occurrences of the previous element; "|": means "or"

Term
EBNF
Definition

Terminals: enclosed in single quotes, such as 'a', '+', 'begin'

Nonterminals: not enclosed

Production Rules: A single nonterminal, followed by "→", followed by a sequence of terminals and nonterminals

MetaSymbols: Optional: "[]"; Alternative: "|"; Group: "()"; Repetition: "{}"

Term
Nonterminal: Y
Definition
[image]
Term
Terminal: X
Definition
[image]
Term
Sequence: Y1 Y2
Definition
[image]
Term
Alternation: Y1|Y2|Y3
Definition
[image]
Term
Optional: [Y]
Definition
[image]
Term
Repetition: {Y}
Definition
[image]
Term
Parse tree for A:=B*(A+C)
Definition
[image]
Term
Semantics Rules
Definition
Constraints applied to syntactically correct program before execution
Term
Static semantics
Definition
Rules that are enforced by the compiler at compile time. Any constraints that can be checked at compile time. E.g.: Type checking, check functions/methods, formal and actual parameters, etc.
Term
Dynamic semantics
Definition
Rules of a given construct that are enforced at the run-time. It is the meaning of each construct of a language
Term
Operational Semantics
Definition
Describe the meaning of a program by executing its statements on an abstract machine. Each program statement is described by a set of operations of this machine. State changes are defined by coded algorithms.
Term
Axiomatic Semantics
Definition
Based on formal logic (First order predicate calculus). Define axioms or inference rules for each statement type in the language (to allow transformations of expressions to other expressions).
Term
Functional (Denotational) Semantics
Definition
The most abstract semantics description method based on recursive theory. The operations of the computer are simulated by writing mathematical functions.
Term
Operating system
Definition
Provides runtime process management, file system for storing programs, I/O operations
Term
Compiler
Definition
Provides source to object code translation
Term
Runtime system
Definition
Provides runtime library
Term
Pure Interpretation
Definition
[image]
Term
Pure Interpretation
Definition
Source code is not translated but run directly by a software interpreter; Allows easy source level debugging implementation, provides maximum flexibility, but suffers slow execution speed and large memory requirement; Difficult to build an interpreter because of high level constructs; Pseudocode: Read the next statement (Fetch), Determine the actions to be executed (Decode), Perform the actions (Execute)
Term
Translation
Definition
[image]
Term
Translation
Definition
Source code is translated (by a compiler) into machine language and run directly by hardware
Term
Compiler
Definition
Has a preprocessor, a lexical analyzer, a parser, optionally an optimizer, and a code generator
Term
Linker
Definition
Links the different user and system object files into the final executable
Term
von Neumann bottle
Definition
The _____ _____ _____ between CPU and memory limits the execution speed
Term
Loader
Definition

Performs the following tasks:

  1. Reads the executable and creats an address space large enough for the program and its data
  2. Copies the instructions and data into memory
  3. Initializes the machine's registers and sets the stack pointer
  4. Loads the Program Counter with the address of the entry point of the program (main method in Java or C)
  5. Starts the execution
Term
Hybrid Implementation Systems
Definition
Source code is translated into an intermediate form and run by a software virtual machine; E.g.: Java compiler produces byte code that can be run on any Java virtual machine (JVM)
Term
Programming Environment
Definition
A set of tools that help programmers develop applications
Term
Overloading
Definition

Commonly used to create several methods with the same name that perform similar tasks. Java enables methods of the same name to be defined if they have different signatures

public int square(int side);

public double square(double side);

Term
Generics
Definition
Allow the same code to be used for multiple data types. E.g.: ADT stack, sorting, searching, etc. Called templates in C++. Bound to actual types by instantiation at compile time
Term
Built-In/Primitive Types
Definition

Types that are not built from other types. Mimics hardware unit

E.g.: Char in C. Boolean in Java. Not String or boolean in C

Term
Data Aggregate
Definition
Also called compound object. Consists of one or more data type objects. E.g.: Arrays
Term
Type Constructor
Definition
Method used to create an aggregate data type. E.g.: Cartesian Products, Sequences
Term
Cartesian Product
Definition

A constructor used to create records and structures

[image]

Term
Mapping
Definition
A function from a set of values (domain) to a set of values (range)
Term
Array Constructor
Definition

Mapping from a set of integers (index) to a set of values (content of the array)

[image]

Term
Union
Definition

A constructor that allows objects to be specified by a disjunctive of fields. E.g.: field1 or field2 or ... or fieldn

An instance object has only one field: Save space. It is up to the programmer to remember which address is valid

[image]

Term
Powerset
Definition
A constructor that creates a variable whose value is a set of elements of type T. T is called the base type. E.g.: set type in Pascal, Java APIs: Sets
Term
Sequence
Definition
Constructor allows the creation of objects whose number of elements are not specified. Objects will have arbitrary size. E.g.: sequential files, Vector, List in Java
Term
User-defined Types
Definition

The ability to create new data types using primitive data types

[image]

Term
Abstract Data Type (ADT)
Definition
An extension to the record or structure construct: Plus routines. C++/Java: _____ is a class construct
Term
Constructor
Definition

Allocates and initializes the fields of an ADT. Languages usually provide a default _____ and default initializations

[image]

Term
Deconstructor
Definition
Releases the memory allocated for an instance. C++: a _____ has the name of the class prefixed by '~'. Java: provides a garbage collector to clean memory allocated by an object
Term
Generic ADT
Definition

An ADT that takes data types as parameters

[image]

Term
strong
Definition
A type system is said to be _____ if it guarantees not to generate type errors
Term
Coercion rules
Definition
Weakens the value of strong typing
Term
Static Type System
Definition

The type of each expression must be known at compile time

Requirements: Only built-in types can be used. All variables are declared with an associate type. All operations are specified by stating the types of the required operands and the type of the results

Term
Statically, strongly
Definition
_____ typed languages are _____ typed languages
Term
Type Compatibility
Definition
Also called conformance or equivalence. A compatible type is one that is either legal for the operator, or is allowed under language rules to be implicitly converted, by compiler-generated code, to a legal type
Term
Name Compatibility
Definition
Two variables can have compatible types only if they are in either the same declaration or in declarations that use the same type name. Highly restrictive. Easier to implement. Ada uses
Term
Structure Type Compatibility
Definition
Two variables have compatible types if their types have identical structures. More flexible. Difficult to implement: compare the whole structure instead of just names. Types are compatible if T1 is name compatible with T2 or T1 and T2 are defined by applying the same type constructor to structurally compatible corresponding type components
Term
Type Conversion
Definition

Needed when the types of an expression are not compatible

func: T1→R1

T1 x1;

R1 x2;

x2=func(x1);

Term
Coercion
Definition
Automatic conversions
Supporting users have an ad free experience!