date: 2024-12-11
title: Compiler-Intermediate Code Generation & Code Optimization
status: DONE
author:
- AllenYGY
tags:
- NOTE
- Compiler
publish: true
Compiler-Intermediate Code Generation & Code Optimization
Intermediate code separates the front end and the back end.
It is an intermediate level between
It is internal to compilers. Different compilers may have different intermediate codes.
Possible types of intermediate code:
Each 3AC instruction consists of at most
For example,
To convert a parse tree to 3AC, we need two synthesized attributes for each node in the parse tree.
Suppose we have a grammar production
The function
Define the attributes for the following grammar