You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61-10
Original file line number
Diff line number
Diff line change
@@ -23,28 +23,33 @@ There are 6 phases in a compiler. Each of these phases help in converting the hi
23
23
24
24

25
25
26
-
**Lexical analyzer:** Reads the source code and converts it to tokens. Tokens are defined by regular expressions. Which are understood by the lexical analyzer. And the analyzer also removes the comments in the code and whitespaces.
26
+
**Lexical analyzer:**
27
+
Reads the source code and converts it to tokens. Tokens are defined by regular expressions. Which are understood by the lexical analyzer. And the analyzer also removes the comments in the code and whitespaces.
27
28
28
-
**Syntax analyzer:** this is also known as the parser. It reads the tokens one by one and uses context free grammar to construct the parse tree.
29
+
**Syntax analyzer:**
30
+
This is also known as the parser. It reads the tokens one by one and uses context free grammar to construct the parse tree.
29
31
30
-
**Semantic analyzer:** verifies the parse tree, and does - type checking, Label checking and Flow control checking.
32
+
**Semantic analyzer:**
33
+
Verifies the parse tree, and does - type checking, Label checking and Flow control checking.
31
34
32
-
**Intermediate Code Generator:** Generates intermediate code which can be executed by the machine. Till the intermediate code it's the same for every compiler. But Intermediate code generator and steps after that depends on the platform the code is compiled for.
35
+
**Intermediate Code Generator:**
36
+
Generates intermediate code which can be executed by the machine. Till the intermediate code it's the same for every compiler. But Intermediate code generator and steps after that depends on the platform the code is compiled for.
33
37
34
-
**Code optimizer:** transforms the intermediate code in a manner that it uses fewer resources and runs faster. But the meaning of the code is not altered. And there are two types of optimization, machine dependent and machine independent.
38
+
**Code optimizer:**
39
+
Transforms the intermediate code in a manner that it uses fewer resources and runs faster. But the meaning of the code is not altered. And there are two types of optimization, machine dependent and machine independent.
35
40
36
-
**Target code generator:** This is the final step of the compilation process. It rewrites the optimized code into machine language.
41
+
**Target code generator:**
42
+
This is the final step of the compilation process. It rewrites the optimized code into machine language.
37
43
38
44
39
-
### **What is the Symbol table**
40
-
45
+
**What is the Symbol table?**
41
46
Symbol table is a data structure maintained and being used by the compiler which contains all the identifier names with their symbols. It helps the compiler to find the identifiers quickly.
42
47
43
48
# **Design**
44
49
45
50
## **Architecture**
46
51
47
-
The language supports control structures and variable declarations. And it supports integer, boolean variable types. Boolen expressions only appear in control structures. The language supports arithmetic operations (addition, subtraction, multiplication, division) on integers and has IF-THEN-ELSE, IF-THEN and WHILE-DO control structures.
52
+
The language supports **control structures** and **variable declarations**. And it supports **integer** , **boolean** variable types. Boolen expressions only appear in control structures. The language supports arithmetic operations **(addition, subtraction, multiplication, division)** on integers and has <code> IF-THEN-ELSE, IF-THEN </code> and <code> WHILE-DO </code> control structures.
48
53
49
54

50
55
@@ -56,8 +61,54 @@ The language supports control structures and variable declarations. And it suppo
56
61
57
62
## **Grammar**
58
63
59
-

64
+
<!---  --->
65
+
```
66
+
G = { N , T , P , S }
67
+
68
+
N = { prgmbody, stmntlist, stmnt, explist, expitem, boolreln}
0 commit comments