Which information belongs in a symbol table for semantic checking?
- Editor colours, line-wrapping preferences and current cursor positions
- Processor clock speeds, cache capacities and remaining battery charge
- Declaration kinds, types, scopes and function parameters
Here + requires two numbers and does not convert strings. n is a number and s is a string. Which expression has valid syntax but fails type checking?
Valid grammatical structure guarantees that code passes this lesson's static semantic checks.
Circle one: True False
In the lesson's symbol-table model, when are entries added and consulted?
- Uses create declarations; declarations later search the recorded name uses
- Parsing completes every name check; later stages never consult declarations
- Declarations add entries; name uses consult them under scope rules
paint takes three numbers, and red is a declared number. paint(red) has valid syntax. What information exposes its argument-count mismatch?
- The token entries saying paint and red are both names
- The declaration saying paint takes three parameters
- The target's instruction list specifying its visible registers
How can a shared IR support several languages and targets?
- Front ends produce it, and compatible target back ends consume it
- Each source language requires an incompatible IR for every target machine
- It replaces declaration checking by deleting all names from the source text
A name has valid token spelling and appears in a valid expression. What further information decides whether it is declared here?
- Only whether its letters match the language's identifier-token pattern
- Only whether its expression node occupies a valid grammatical position
- Which declaration is visible under the current scope rules, if any
Three existing back ends consume one IR. A new language can express all its operations in that IR. Which new component lets it reuse those back ends?
- Three new parsers, each emitting a different target's machine instructions
- One new front end translating the language into the shared IR
- One replacement symbol table removing all target-specific instructions