Programming Languages Chapter 9

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/39

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

40 Terms

1
New cards

Basic Expressions

Literals (constants) and identifiers

2
New cards

Complex expression

Built up recursively from the basic expressions by the application of operators and functions

3
New cards

Parentheses

Group symbols

4
New cards

Operator

Predefined, written in infix form (if binary), with associativity and precendence

5
New cards

Function

Either predefined or user-defined, written in prefix form, operands are viewed as arguments

6
New cards

New Design

Allow programmers to overload built-in operators. Define new infix operators with arbitrary associativity and precedence

7
New cards

Applicative Order Evaluation/Strict Evaluation

The most common rule in programming languages. Correspond to a bottom-up reduction of the syntax tree to a value.

8
New cards

Operands

Applicative Order Evaluation evaluates ____ first and then apply them to operators

9
New cards

Arguments

Applicative Order Evaluation evaluates ____ first and then apply them to functions

10
New cards

Natural Order

Follow the predefined precedence of operators

11
New cards

Left to right

For operators of the same precedence

12
New cards

Infix Notation

Correspond to inorder traversal of the syntax tree

13
New cards

Unary Operator - Infix Notation

Write the operator first followed by the operand

14
New cards

Binary Operator - Infix Notation

Write the 1st operand followed by the operator and then the 2nd operand

15
New cards

Prefix Notation

Correspond to preorder traversal of the syntax tree

16
New cards

unary operator - Prefix Notation

Write the operator first followed by the operand

17
New cards

binary operator - Prefix Notation

Write the operator followed by the 1st operand and then the 2nd operand

18
New cards

Postfix Notatiion

Correspond to postorder traversal of the syntax tree

19
New cards

Unary Operator - Postfix Notion

Write the operand first followed by the operator

20
New cards

Binary Operator - Postfix Notion

Write the 1st operand followed by the 2nd operand and then the operator

21
New cards

GoTo Controversy

Provide a very flexible control. May result in spaghetti code

22
New cards

Modern Syle

Group code into logical blocks. Avoid explicit jumps. Cannot jump into the middle of block or function

23
New cards

Conditional Branch, loop, and function call/return

Modern style avoids explicit jumps except

24
New cards

Boolean test or logical test

Make __ before entering a sequence of statements

25
New cards

EBNF

if-statemnt → if(expression) statement [else statement]

26
New cards

Statement

Can be a single statement, a null statement, or a sequence of statements surrounded by braces

27
New cards

Dangling Else

The ambiguity between the association of an if and an else

28
New cards

Most Closely Nested Rule

The else is to be associated with the closest prior if that doesn’t have an else part

29
New cards

bracketing keyword

Ada dangling-else problems

30
New cards

Loops

Used to perform repetitive operations

31
New cards

Exception

An unusual event. Usually unpredictable. Detectable by software or hardware, required special processing

32
New cards

Variable or class

C++ an exceptional event is represented by

33
New cards

An Exception Handler

A section of program codes executed when a particular exception occurs

34
New cards

Catches

One part of the program _____ and processes the exception that another part of the program throws

35
New cards

Throw (raise)

To signal the fact that an exception has occurred

36
New cards

Exception Handler Selection

Examines error types in exception handlers

37
New cards

North-South

Exception Handler Selection Order

38
New cards

catch-all

Ellipse parameter (…) is a wild card

39
New cards

User-defined classes (or structures)

Use ___ as exception types

40
New cards

Nonlocal Exception Handlers

It is more common to throw an exception inside a function called by a try-block