SOLUTION RATED A+
✔✔What does *popularity* mean? - ✔✔- readily accessible, reliable
- easily understood
✔✔How is Java's *readability* compared to C++? - ✔✔Same
✔✔How is Java's *reliability* compared to C++? - ✔✔More
✔✔How is Java's *efficiency* compared to C++? - ✔✔Less
✔✔What are the 5 *compiler phases*? - ✔✔1. Lexical Analysis
2. Syntactic Analysis
3. Semantic Analysis
4. Optimization
5. Code Generation
✔✔What does *lexical analysis* input and output? - ✔✔Input: Source code
Output: Token stream
✔✔What does *syntactic analysis* input and output? - ✔✔Input: Token stream
Output: Parse tree
✔✔What does *semantic analysis* input and output? - ✔✔Input: Parse tree
Output: Checked parse tree
✔✔What does *optimization* input and output? - ✔✔Input: Checked parse tree
Output: Checked parse tree
✔✔What does *code generation* input and output? - ✔✔Input: Checked parse tree
Output: Machine instructions
✔✔What is the difference between syntax and semantics? - ✔✔1. *Syntax*: the form of
the elements of a language; the set of rules that govern the arrangement of strings to
create valid sentences in a language
2. *Semantics*: the meaning of sentences in a language, the execution behavior
✔✔What 4 things is a grammar made up of? - ✔✔1. Terminals (T)
2. Non-Terminals (N)
3. Start Symbol (S)
4. Productions (P)
✔✔What is a *meta-language*? - ✔✔A language used to describe another language
, ✔✔What is a *recursive rule*? - ✔✔A rule that appears in the LHS and the RHS of the
same rule
✔✔What are the properties of a parse tree? - ✔✔1. The root is the start symbol
2. All sub-trees are a production of G
3. An in-order traversal of the leaves returns the original string
✔✔What phases can static time be broken down into? - ✔✔1. Language design time
2. Language implementation time
3. Program compile time
✔✔What do we care about when it comes to binding? - ✔✔1. Type
2. Name
3. Memory location
4. Value
✔✔What is *type binding*? - ✔✔binding type of a *data type* to a *reference*
1. static type binding
2. dynamic type binding
✔✔What is *static type binding*? - ✔✔types are be checked at compile time; variables
must be bound to a type before usage
1. Explicit declaration: reserve memory location and associate with the name, then store
the value
2. Implicit declaration: declare a variable and the compiler infers the type based on the
value
✔✔What are the advantages of *static type binding*? - ✔✔- can check for errors at
compile time
- easier to resolve errors
- more efficient b/c you don't have to check every variable's type at runtime
✔✔What is *dynamic type binding*? - ✔✔types are checked at runtime; variables are
assigned to a type during execution
✔✔What is *address binding*? - ✔✔binding type of a *memory address*
1. static variable
2. dynamic variable
✔✔What is a *static variable*? - ✔✔the memory address is bound at compile time