Please enable JavaScript.
Coggle requires JavaScript to display documents.
Lecture 1 - Coggle Diagram
Lecture 1
Syntax
How programs can be written
Defines set of rules for combinig text to form valid programs
Maps program text to meaningful units (tokens)
Common Language Tokens
Identifiers
Keywords / Reserved words
Literals
Operators
Special symbols
Whitespace
Syntax rules
Dictates valid structuring of program text
Formal definition: Grammar
Different levels of expressive power (CS 133)
Enables parsing of source code (CS 155)
Most common: Backus-Naur Form (BNF)
Terminal: Text literal
Example: '1' , 'a' , '+'
Nonterminal: Abstract symbol for expansion
Example: <A> , <number>, <expr>
Production rule: Transformation from A to B
Example 1: A->B or A ::= B
LHS mus contain single nonterminal <add-expr> -> <number> '+' <number
Example2: A -> B | C | D (transformation options)
<digit> -> '0' | '1' | ... | '9'
Grammar Use Cases
Generating syntactically valid text
Checking syntactic validity of text
Te
Identifying syntactic parts of text
Conceptual Framework
Context
New programming Lngauges and features
Easier to learn with a conceptual framework
Distillessence of Programming Language Differences
Framework
Semantics
Language Features
Implementation
Ecosystem
Programming Practices
Summary