Lexical And Syntax Analysis

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

1/16

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.

17 Terms

1
New cards

Compilation

involves translating high-level code into machine code using a compiler.

2
New cards

Pure interpretation

executes the original source code directly using an interpreter.

3
New cards

• Hybrid implementation

combines both methods. It translates high-level code into an intermediate representation, which is then interpreted.

4
New cards

Lexical analysis

also known as scanning, is the first phase of processing source code. It converts the raw source code into tokens

5
New cards

syntax analyzer

takes the generated tokens and verifies whether they follow the grammatical rules of the programming language.

6
New cards

lexical analyzer

is a pattern matcher that identifies tokens.

7
New cards
  1. Simplicity

  2. Efficiency

  3. Portability

separate lexical analysis from syntax analysis to improve:

8
New cards

state diagram

represents a finite automaton used for token recognition.

9
New cards

Terminal Symbols

These are keywords, operators, or punctuation marks that cannot be broken down further.

10
New cards

Non Terminal Symbols

are like the branches of a tree—abstract structures built by combining terminals or other nonterminals.

11
New cards

Bottom-up parsing

  • is a technique used in syntax analysis of programming languages, where the parser starts with the input and works backward to reconstruct the parse tree

  • reconstruct a rightmost derivation in reverse.

12
New cards

LR parser

The most well-known bottom-up parsing algorithm

13
New cards

Rightmost Derivation

means we always expand (replace) the rightmost non-terminal first at each step.

14
New cards

Recursive-descent parsing

  • is a top-down parsing method used in syntax analysis for programming languages

  • It consists of a set of recursive rules, each corresponding to a nonterminal symbol in a grammar and produces a parse tree in top-down order.

15
New cards

Top-down parsers

Construct leftmost derivations and a parse tree in top-down order.

16
New cards

Syntax analysis

is a common part of language implementation, regardless of the implementation approach used. It is normally based on a formal syntax description of the language being implemented.

17
New cards

BNF (Backus-Naur Form)

The most common approach for describing syntax is a context-free grammar, also known as