Skip to content

Q: Is type checking done by semantic analyzer? #4

Answered by pgrandinetti
Glyphack asked this question in Q&A
Discussion options

You must be logged in to vote

According to my notes: yes, type checking is (typically) done in the Semantic Analysis step.
Broadly speaking:

  1. Lexer: divides the input in tokens.
  2. Parser: transforms the sequence of tokens in the parse tree.
  3. Semantic analyzer: perform several operations, including type checking, error reporting and it tries to identify as many consistencies as possible (which often depends on the language specifications at hand).
  4. Optimizer: perform smart transformation of the parse tree to improve the code.
  5. Code generator: transforms the optimized parse tree in machine code.

Ref. Dragon book 2nd edition, Section 1.2 (specifically, 1.2.3)

I'm curios to know if there's any different between semantic anal…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Glyphack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2 on August 02, 2023 09:36.