Programming Languages 1 MIDTERM

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
full-widthPodcast
1
Card Sorting

1/38

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:31 AM on 3/25/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

39 Terms

1
New cards

Lexical analysis

This involves reading the source code character from left to right and organizing them into tokens.

It eliminates comments and whitespace within the source code.

2
New cards

tokens

Lexical Analysis aims to read the input code and break it into meaningful elements called _______ for a computer to understand easily.

3
New cards

Lexical analyzer

collects characters into logical groupings and assigns internal codes to the groupings based on their structure.

4
New cards

lexemes

These logical groupings of lexical analyzer is called _______

5
New cards

tokens

the internal codes for categories of these groupings are the ____

6
New cards

regular expressions

In programming language, tokens can be described using ________

7
New cards

Deterministic Finite Automaton (DFA)

A lexical analyzer uses a __________ to recognize these tokens, as they can identify regular languages.

8
New cards

Input Preprocessing

Involves cleaning up the input text and preparing it for lexical analysis.

This covers the removal of comments, whitespaces, and other non-essential characters from the input text.

9
New cards

Tokenization

Involves the process of breaking the input text into a sequence of tokens.

This is done by matching the characters in the input text against a set of patterns or regular expressions that define the different types of tokens.

10
New cards

Token Classification

The analyzer determines the type of each token.

For instance, the analyzer might classify the keywords, identifiers, operators, and punctuation symbols as separate token types.

11
New cards

Token Validation

The analyzer checks if each token is valid based on the rules of the programming language.

For instance, the analyzer might check that a variable name is a valid identifier or that an operator has the correct syntax.

12
New cards

Output Generation

The analyzer generates the output of the lexical analysis process, typically a list or sequence of tokens (token stream).

The list of tokens can then be passed to the next stage of compilation or interpretation, which will be sent to the parser for syntax analysis.

13
New cards

TOKENS

_______can be individual words or symbols in a sentence, such as keywords, variable names, numbers, and punctuation.

14
New cards

Alphabets

All the numbers and alphabets are considered hexadecimal alphabets by language.

15
New cards

Strings

The collection of different alphabets occurring continuously

16
New cards

string length

The _____ is defined by the number of characters or alphabets occurring together.

For example, the length of |STIisthebest| is 12 since there are 12 characters.

17
New cards

Symbols

High-level programming languages contain special symbol

18
New cards

Non-tokens

Comments, preprocessor directive, macros, blanks, tabs, newlines.

19
New cards

LEXEMES

____ are the sequence of characters matched by a pattern to form the token or a sequence of input characters that comprises a single token.

20
New cards

Syntax analysis, or parsing

Is the process of analyzing a string of symbols according to the rules of formal grammar.

It checks the source code to ensure that it follows the correct syntax of the programming language it is written.

21
New cards

Syntax errors

are identified and flagged in this phase and must be corrected before the program can be successfully compiled.

22
New cards

Parse tree or Abstract Syntax Tree (AST)

A _______ is the output of this phase, representing the program’s structure.

23
New cards

context-free grammar (CFG)

Syntax analysis uses ____ to define the syntax rules of a programming language.

They include production rules that describe how valid strings (token streams) are formed.

This also specify the grammar of a language to ensure that the source code adheres to the language’s syntax.

24
New cards

Parsing

The tokens are analyzed based on the grammar rules of the programming language.

A parse tree or AST is constructed to represent the hierarchical structure of the program.

25
New cards

Error Handling

If the input program contains syntax errors, the syntax analyzer detects and flags them to the user, indicating where the error occurred.

26
New cards

Symbol Table Creation

The syntax analyzer creates a symbol table, a data structure that stores information about the identifiers used in the program, such as type, scope, and location.

27
New cards

Derivation

It is the process of applying the rules of Context-Free Grammar to generate a sequence of tokens to form a valid structure.

Simply, it is a sequence of production rules to get the input string for the parser.

28
New cards

left-most derivation

It is called _____ if the sentential form of an input is scanned and replaced from left to right.

29
New cards

left-sentential form

What do you call to the derived sentimental form of left-most deriverasion

30
New cards

right-most derivation

It is called the _____ if the input is scanned and replaced with production rules

31
New cards

right-sentential form

What do you call to the derived sentimental form of right-most deriverasion

32
New cards

Parse Tree

It is the graphical representation of a derivation. It is convenient to see how strings are derived from the start symbol, which becomes the root of the parse tree.

33
New cards

Ambiguity

The grammar is ambiguous if it has more than one parse tree, either left or right derivation, for at least one (1) string.

34
New cards

inherently ambiguous

The language generated by ambiguous grammar is _______. No method can detect and remove ambiguity automatically.

Still, it can be removed by either re-writing the whole grammar without ambiguity or by setting and following associativity and precedence constraints. These methods decrease the chances of ambiguity in a language or its grammar.

35
New cards

Associativity

When an operand has operators on both sides, the side on which the operator takes this operand is decided by the association of those operators.

36
New cards

Left-associative operations

include Addition, Multiplication, Subtraction, and Division.

For example: id op id op id will be evaluated as (id op id) op id

Simply, 2 + 3 + 4 will be evaluated as (2 + 3) + 4

37
New cards

Right-associative operations

such as exponentiation will have the following evaluation in the same expression.

For example: id op id op id will be evaluated as id op (id op id) Simply, 2 ^ 3 ^ 4 will be evaluated as 2 ^ (3 ^ 4)

38
New cards

Precedence

When two (2) different operators share a common operand, the precedence of operators decides which will take the operand

39
New cards

hierarchy of priorities

In Python, some operators are performed before others. It is called the __________

Explore top notes

note
Spelling, Punctuation and Grammar
Updated 783d ago
0.0(0)
note
APWH UNIT 1TOPIC 1.1 SPICE T
Updated 1266d ago
0.0(0)
note
The American Revolution
Updated 270d ago
0.0(0)
note
APHUG-All Units
Updated 532d ago
0.0(0)
note
Chapter 1- Kinetic Particle Theory
Updated 1278d ago
0.0(0)
note
Chemical Changes
Updated 1353d ago
0.0(0)
note
Spelling, Punctuation and Grammar
Updated 783d ago
0.0(0)
note
APWH UNIT 1TOPIC 1.1 SPICE T
Updated 1266d ago
0.0(0)
note
The American Revolution
Updated 270d ago
0.0(0)
note
APHUG-All Units
Updated 532d ago
0.0(0)
note
Chapter 1- Kinetic Particle Theory
Updated 1278d ago
0.0(0)
note
Chemical Changes
Updated 1353d ago
0.0(0)

Explore top flashcards

flashcards
Spelling 1
22
Updated 938d ago
0.0(0)
flashcards
Chapter 3
46
Updated 1148d ago
0.0(0)
flashcards
G1 2nd Semester Grammar Review
60
Updated 1044d ago
0.0(0)
flashcards
House part 한국어7
28
Updated 296d ago
0.0(0)
flashcards
6.1.1 Earth, Moon, & Sun System
30
Updated 937d ago
0.0(0)
flashcards
maatschappijleer p2
57
Updated 1150d ago
0.0(0)
flashcards
Geometry Midterm Review RBC
136
Updated 463d ago
0.0(0)
flashcards
Apol Obj. Test
64
Updated 1167d ago
0.0(0)
flashcards
Spelling 1
22
Updated 938d ago
0.0(0)
flashcards
Chapter 3
46
Updated 1148d ago
0.0(0)
flashcards
G1 2nd Semester Grammar Review
60
Updated 1044d ago
0.0(0)
flashcards
House part 한국어7
28
Updated 296d ago
0.0(0)
flashcards
6.1.1 Earth, Moon, & Sun System
30
Updated 937d ago
0.0(0)
flashcards
maatschappijleer p2
57
Updated 1150d ago
0.0(0)
flashcards
Geometry Midterm Review RBC
136
Updated 463d ago
0.0(0)
flashcards
Apol Obj. Test
64
Updated 1167d ago
0.0(0)