{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

Lecture 4 Flashcards

(14 cards)

1
Q

Lexical structures

A

Lexical structures, which concerns the forms of its individual symbols.

e.g := (keywords, identifiers)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Syntax

A

Defines structure of components of language eg structures of programs, statements, expressions, terms etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Semantics

A

Defines the meanings and usage of structures and requirements that cannot be described by grammar.

Checking type consistency, applying + operator to two numerical values is to evaluate the arithmetic sum.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Semantic Description problem

A

SEMANTICS MORE DIFFIICULT TO DEFINE than syntax and not well accepted methods for semantic definition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Languages Analysis

A

Language implementation must analyse source code - its lexical and syntax structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Language Analysis two parts.

A

Low level is lexical analyzer, mathematically finite automation based on regular grammar.

High level is syntax analyser, or parser whcih is mathematically a push down automation based context free grammar.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

lexical analyser (a.k.a. scanner

A

Reads source code character-by-character

Groups characters into tokens

Removes whitespace and comments

Sends tokens to the parser (next phase)

substrings of source program as lexemes.

sum is a lexeme; its token may be IDENT.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Lexical Analysis ( Alphabet )

A

An alphabet Σ is a finite non-empty set (of symbols).

the set Σab = {a, b} is an alphabet comprising symbols a and b;

– the set Σaz = {a, …, z} is the alphabet of lowercase English letters;

– the set Σasc of all ASCII characters is an alphabet.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Lexical Analysis (String)

A

A string or word over an alphabet Σ is a finite concatenation (or juxtaposition) of symbols from
Σ. For example,

  • abba, aaa and baaaa are strings over Σab;
    – hello, abacab, and baaaa are strings over Σaz;
    – h$(e′lo, PjM#;, and baaaa are strings over Σasc.
  • The length of a string w (that is, the number of
    symbols it has) is denoted |w|. E.g., |abba| = 4.
  • The empty or null string is denoted ε, and so |ε|
    = 0.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Set of all strings…

A

set of all strings over Σ is denoted Σ∗

E.g., Σ ∗ ab = {ε, a, b, aa, ab, ba, bb, aab,…}

For any symbol or string x, x n denotes the string of the concatenation of n copies of x.

E.g.

a^4 = aaaa
(ab)^4 = abababab

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Regular Expressions

A

specifiy parterns of string or symbols.

r matches or is matched by set of strings if the patterns of the strings are specified by the Reg Ex.

Set of strings matched by RE r is denoted by L(r) ⊆ Σ∗ ( if strings belong to alphbet Σ) is called by language determined by r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Regular Expression Definiton

A

∅ (empty set symbol) is regular expression. not useful.

ε (the empty string symbol) is a regular
expression. This matches just the empty string ε.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

∅ and ε

A

empty string ε should not be confused with the empty language ∅

∅ is a formal language (i.e., a set of strings) that contains no strings, not even the empty string. ε

The empty string is a string that has the
properties:

ε +s =s +ε =s i.e., the empty string is the identity element of the concatenation operation

ε |=0. i.e., its length is zero.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly