Skip to content

Commit

Permalink
improved README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DrEden33773 committed Oct 4, 2024
1 parent 01a6478 commit 089cc46
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/pl_0.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
## To begin with

This is the `curriculum design` of `Compiler Principle` course in `Nanjing University of Aeronautics and Astronautics` (aka. `NUAA`).
This is the `curriculum design` of `Compiler Principle` course in `Nanjing University of Aeronautics and Astronautics` (
aka. `NUAA`).

## Introduction

Expand Down Expand Up @@ -45,11 +46,11 @@ This is a simple `Rust` implementation of `PL/0` compiler.
## Structure

$$
\set{Source Code} \Longrightarrow \textbf{Lexer} \stackrel{Token}{\Longrightarrow} \textbf{Parser} \stackrel{AST}{\Longrightarrow} \textbf{CodeGen} \Longrightarrow \set{PCode} \longrightarrow \textbf{VM} \longrightarrow \set{Result}
\set{Source Code} \Longrightarrow \textbf{Lexer} \stackrel{Token}{\Longrightarrow} \textbf{Parser} \stackrel{AST}{\Longrightarrow} \textbf{CodeGen} \Longrightarrow \set{PCode} \longrightarrow \textbf{VM} \longrightarrow \set{Result}
$$

| Part | Analysis List |
| :-----: | :-----------------: |
|:-------:|:-------------------:|
| Lexer | `Lexical Analysis` |
| Parser | `Syntax Analysis` |
| CodeGen | `Semantic Analysis` |
Expand All @@ -66,15 +67,18 @@ This part is extreme easy, I've implemented it in my own hand without using any

With the help of `Recursive Descent Algorithm`, `parser` is also not that hard to implement.

However, it's necessary to prove that the given [BNF](#bnf) satisfy the definition of `LL(1)` before implementing `parser` in `Recursive Descent Algorithm`.
However, it's necessary to prove that the given [BNF](#bnf) satisfy the definition of `LL(1)` before implementing
`parser` in `Recursive Descent Algorithm`.

Proof will be given later.

### Error Handling

I've adopt the welcomed `panic-mode-liked` error handling strategy for this part, to make sure that the `compiler` could find as many errors as possible in one run, instead of being halted by the first error.
I've adopted the welcomed `panic-mode-liked` error handling strategy for this part, to make sure that the `compiler`
could find as many errors as possible in one run, instead of being halted by the first error.

To make sure error could be handled in a `synchronous` way, `FIRST-FOLLOW` table is a must (I've build this manually, which could be further improved by using auto-tools).
To make sure error could be handled in a `synchronous` way, `FIRST-FOLLOW` table is a must (I've built this manually,
which could be further improved by using auto-tools).

### Codegen

Expand All @@ -84,7 +88,8 @@ I'm working on a `AST` to `Lua-Backend-Adapted-Representation` (LBAR) code-gener

### Virtual Machine (aka. VM / Interpreter)

Sense `PCode` is the default execution result of `codegen`, the `Simple-PCode-Interpreter` is the default implementation of `Virtual Machine`
Sense `PCode` is the default execution result of `codegen`, the `Simple-PCode-Interpreter` is the default implementation
of `Virtual Machine`

Still, I'm trying to implement a `Lua-VM-Liked-VM` for `LBAR`

Expand Down Expand Up @@ -291,7 +296,8 @@ Symbol Table:

## Error Handling Demos

As is mentioned follow, this implementation of pl/0 compiler has a complete error handling strategy, which means that it could find as many errors as possible in one run, instead of being halted by the first error.
As is mentioned follow, this implementation of pl/0 compiler has a complete error handling strategy, which means that it
could find as many errors as possible in one run, instead of being halted by the first error.

Here are some simple demos:

Expand Down

0 comments on commit 089cc46

Please sign in to comment.