Skip to content

Commit

Permalink
Merge pull request #25 from mrLSD/feat/extend-ast-expr-value
Browse files Browse the repository at this point in the history
Feat: Extend `ExpressionValue` with a custom generic extensible field
  • Loading branch information
mrLSD committed Jan 16, 2024
2 parents 53b67a0 + 4e8388d commit fb7afaa
Show file tree
Hide file tree
Showing 22 changed files with 615 additions and 264 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Run grcov
run: |
mkdir ./target/debug/coverage/
grcov . -s . -b ./target/debug/ -o ./target/debug/coverage/ --ignore-not-existing --excl-line="grcov-excl-line|#\\[derive\\(|//!|///" --ignore="*.cargo/*" --ignore="src/lib.rs" --ignore="tests/*"
grcov . -s . -b ./target/debug/ -o ./target/debug/coverage/ --ignore-not-existing --excl-line="grcov-excl-line|#\\[derive\\(|//!|///" --excl-start="grcov-excl-start" --excl-stop="grcov-excl-end" --ignore="*.cargo/*" --ignore="src/lib.rs" --ignore="tests/*"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "semantic-analyzer"
version = "0.3.3"
version = "0.4.0"
authors = ["Evgeny Ukhanov <[email protected]>"]
description = "Semantic analyzer library for compilers written in Rust for semantic analysis of programming languages AST"
keywords = ["compiler", "semantic-analisis", "semantic-alalyzer", "compiler-design", "semantic"]
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

Semantic analyzer is an open source semantic analyzer for programming languages
that makes it easy to build your own efficient compilers.
that makes it easy to build your own efficient compilers with extensibility in mind.

## 🌀 What is the library for and what tasks does it solve

Expand Down Expand Up @@ -53,6 +53,10 @@ Supported condition expressions and condition expression correctness check.
**Building the Symbol Table**: For analyzing used the symbol table as data structure used by the semantic analyzer to keep track of
symbols (variables, functions, constants) in the source code. Each entry in the symbol table contains the symbol's name, type, and scope related for block state, and other relevant information.

**Generic expression value**: The ability to expand custom expressions for AST,
according to compiler requirements. And the ability to implement custom instructions
for these custom expressions in the **Semantic Stack Context**.

### 🌳 Semantic State Tree

The result of executing and passing stages of the semantic analyzer is: **Semantic State Tree**.
Expand Down Expand Up @@ -104,6 +108,17 @@ analysis and source code parsing, it is recommended to use: [nom is a parser com

AST displays the **Turing complete** programming language and contains all the necessary elements for this.

## 🔋 🔌 Extensibility

Since `AST` is predefined, but in real conditions it may be necessary to expand the
functionality for the specific needs of the `compiler`, has been added the functionality
of the `AST` extensibility and the additional generated set of `Instructions` for
the **Semantic Stack Context**.

- [x] 🚨 **Genetic expression value**: The ability to expand custom expressions for z, according to compiler requirements.
The ability to implement custom instructions for these custom expressions in the
**Semantic Stack Context**.

## 🛋️ Examples

- 🔎 There is the example implementation separate project [💾 Toy Codegen](https://github.com/mrLSD/toy-codegen).
Expand Down
Loading

0 comments on commit fb7afaa

Please sign in to comment.