SSCD PDF
SSCD PDF
SSCD PDF
#Two
is an important concept in compiler design distinctive aspects distinguishes a form 3
that refer to the way in which the compiler address code .# the 1st is that all
reads input from the source code. #input assignment in ssa are to variables with
buffering is a technique that allows the distinct names; hence the term static single
compare to read input in larger chunks, assignment. #the 2nd distinctive aspect of
which can improve performance and ssa is that it uses a notational convention
reduce overhead.#the lexical analyzer called the ¢ function to combine 2
scans the input from left to right to One definitions of variable. Ex—Intermittent
character at a time it uses two pointer program in three address and ssa.
lexeme begin and forward ptr. # A
pointer lexeme begin,marks the beginning M2-the main phases of a compiler:1.
of the current lexeme, whose exten we **Lexical Analysis:* - **Purpose:**
are attempting to determine.# Pointer Breaks the source code into tokens,
forward scans ahead until a pattern match identifying keywords, identifiers,
is found.#When FP encounter first EOF, operators, and literals. - **Tool:** Lexer
the end of first buffer and hence filling up or lexical analyzer.2. **Syntax Analysis
the second buffer.#Alternatively both (Parsing):** - **Purpose:** Checks the
buffers can be filled up until end of the syntax of the source code based on the
input program and stream tokens is language's grammar rules, creating a
identified.#this EOF character introduced hierarchical structure like a parse tree. -
at the end is calling sentinel which is used **Tool:** Parser.3. **Semantic
to identify the end of buffer. Analysis:** - **Purpose:** Ensures that
M5Quadruples :-- A quadruples has four the program has a meaningful
fields : OP, arg1, arg2 e/and result.#Unary interpretation, checking for semantic errors
operations do not use arG2.#param use and enforcing language rules. -
neither arg2 nor result.#chance put the **Tasks:** Type checking, scope analysis,
target label in result#Easier to optimize and resolution of references.4.
and more code around.ex:- 3 address code **Intermediate Code Generation:** -
and it’s quadruples representation.a=b*- **Purpose:** Transforms the source code
c+b*-c Triples:- tri have 3feilds into an intermediate representation that is
op,arg1,arg2.#Temperature are not used independent of the target machine. -
and instead reference to instruction are **Benefits:** Eases optimization and
made#Tripes are also known as two facilitates portability.5. **Code
address code. #triples take less space when Optimization:** - **Purpose:**
compared with quadruples.#opti is Improves the efficiency of the intermediate
difficult#The dag and triple code to enhance the program's runtime
representations of expressions are performance
equivalent. Ex: syntax tree and triples for
the expression.Indirect triples :- in m1-SIC/Xe:- #sic/ xe Stands for
indirect triples, pointers to triples will be simplified instructional.#This computer is
there instead of triples.# optimization by an advanced version of SIC. both sic and
moving code around is easy .#indirect sic/Xe are closely related to each other
triples take less space when compared with that’s why they are upward comparable 1)
quadruples.# both indirect triples and Memory- #memory contains of 8bytes and
quadruples are almost equally efficient. Ex the memory size is 1 megabyte.#Standard
—Indirect triples representation of three siC memory size is very small this change
address code for the expression.Static in the memory size leads to change in
single assignment form:- # ssa it is an instruction format as well as addressing
intermediate representation that facilities modes. 2) register:-# It contains A
registers(SIC register + four additional expression is composed of a sequence of
registers )the four additional registers are:- characters that collectively define a
B-Base register.S- general working pattern. This sequence may include literal
register. T- general working register.f- characters, metacharacters, and special
floating point accumulator. symbols with specific meanings2.
**Pattern Matching:**- The primary
3)Data formats:- #integers are represented purpose of a regular expression is to
by binary numbers.# characters are describe a pattern for matching within
represented using ASCII codes.# Floating strings. It specifies a set of rules or
Points are represented using 48 bits.4) conditions that define the desired structure
Addressing modes:-# to use format 3 use or content of the target text.3.
of base register and program counter is **Metacharacters and Operators:* -
there. #mode- indication#base relatives Regular expressions include
b=1,p=0,program counter-b=0,p=1.5) Instr metacharacters and operators with special
formats:- #in sic/Xe architecture there are meanings. Examples include `.` (dot)
four types of formats available.1)format- representing any character, `*` (asterisk)
1(1-bite) .6)Instruction set:- #it provides for zero or more occurrences, and `|` (pipe)
all instructions like SIC and it has new two for alternation between patterns.4.
registers lob and stb.#Supervisor call is **Flexibility and Expressiveness:* -
provided to handle interrupts.7)Input and Regular expressions provide a flexible and
output:- it is performed by transferring one expressive syntax for describing complex
byte at a time. #It’s has channel to perform patterns concisely. Users can combine
input operations while course is executing various elements such as quantifiers,
instructions. #sio-staet#tio-test#hio-halt.. character classes, and anchors to create
intricate patterns.M4-lex-Definition
M1-List and Explain Data Structure used section:- the definition section can include
in assembler--1. **Symbol Table:** the literally block, definitions, internal
Stores symbols (e.g., labels, variables) table declaration start conditions and
with their corresponding addresses or translations.Rules section:-Rule section
values, facilitating reference resolution and contains pattern lines and c code.# a line
error detection.2. **Opcode Table:** that start with white space. #A line that
Contains mappings of mnemonic start with anything else is a pattern line.
instructions to their corresponding User sub routines :-this action typically
opcodes, aiding in instruction translation includes routines called from the
and validation.3. **Literal Table:** rules.#This section contains any additional
Holds literals encountered in the source C code or functions that you want to
code, along with their addresses or include in your lexical analyzer.
representation in memory, allowing
efficient handling during assembly.4.
**Expression Stack:** Utilized for
evaluating arithmetic expressions
encountered in the source code, aiding in
resolving address calculations and constant
expressions.5. **Location Counter
(LC):** Tracks the current address or
location within the program being
assembled, enabling proper assignment of
addresses to instructions and data. M4-the
character of regular expression:-
**Sequence of Characters:** - A regular