Toolchains Flashcards
What is a toolchain?
• Toolchain: a set of software development tools that are linked (or “chained”)
together
• At its most basic consists of a compiler and a linker to transform source code
into an executable program
What are the main elements of the AVR Toolchain?
The compiler, assembler, linker and library
What is the AVR Toolchain?
Separate programs performing distinct tasks
The ‘core’ of the toolchain is the compiler, assembler, linker and library
• Although these are separate projects, they are interconnected and developed in
partnership
What is semantic analysis?
Semantic analysis is the task of ensuring that the declarations and statements of a program are semantically correct, i.e, that their meaning is clear and consistent with the way in which control structures and data types are supposed to be used.
It observes the;
- Implications of expression
- Type checking, object binding, definite assignment
Example Checks
- Types of the first and second operand
- Check whether + is binary/unary/ternary
- Check number of operands supplied to the operator
What is syntactic analysis?
Syntactic analysis is defined as analysis that tells us the logical meaning of certain given sentences or parts of those sentences. We also need to consider rules of grammar in order to define the logical meaning as well as the correctness of the sentences.
In computing,
- Checking tokens for allowable expression
- Grammar defines components for expressions
In summary
- Checking for the appropriate sequence of tokens
- Checking for right shape/form, but not meaning
How is syntactic analysis parsed?
- State transition table
- Parsing code
Many other methods.
Benefits of syntactic state transition tables
Allow for easy identification of errors and their corresponding location.
What is done once a syntactic error is detected?
Once an error is detected the program will do one of the following to recover from the error
- Panic mode
- Phrase level
- Error productions
- Global correction
Describe Panic Mode Error Recovery
- The parser throws away tokens until a ‘resynchronise’ token is found.
- The token implies (with high probability) one particular place in the syntax diagram. suchas in C.
• Can cause a lot of sources to be skipped (and therefore other errors undetected this time around).
Benefits
• Simple, fast
• Guaranteed to terminate
Describe Phrase Level error Recovery
- Small local correction to the token stream
- Insert, delete or change one token
- For example, apple[*,a:,23]
- Ignore (delete) ‘,’ => apple[*,a:23]
- Now syntactically legal, but if the user meant apple[*, a:b,23] this hasn’t helped much
- BUT the semantic check, later on, will catch it (array reference with an incorrect number of dimensions)
Describe Error Productions Error Recovery
• Build the common errors into the grammar
• A C programmer would want to write
apple[*][a:7][23]
• So include this in the grammar definition
• The parser can get
massive - the designer
has to foresee every
possible error…
Describe Global Production Error Recovery
• The parser takes a fragment of the input token stream
error
tn-3 ⇒ tn-2 ⇒ tn-1 ⇒ tn ⇒ tn+1 ⇒ tn+2 ⇒tn+3
lo…………………..hi
… and tries to match it to the parse diagram, resynchronising wherever the overall mismatch is least
• Computationally expensive
• Not used where the compile/edit loop is tight and fast