Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add grammar, translations and better parser #43

Closed
ElBe-Plaq opened this issue Jun 22, 2023 · 8 comments · Fixed by #71
Closed

[FEATURE] Add grammar, translations and better parser #43

ElBe-Plaq opened this issue Jun 22, 2023 · 8 comments · Fixed by #71
Assignees
Labels
feature New feature.

Comments

@ElBe-Plaq
Copy link
Member

ElBe-Plaq commented Jun 22, 2023

Describe the solution you'd like
Add pest grammar.

Describe alternatives you've considered
BNF, EBNF or ABNF grammar.

Additional context
Pest needs to be added to the dependency list.

This issue is now being used to track other changes as well.

@ElBe-Plaq ElBe-Plaq added the feature New feature. label Jun 22, 2023
@ElBe-Plaq ElBe-Plaq added this to the Release v1.0.0-alpha3 milestone Jun 22, 2023
@ElBe-Plaq ElBe-Plaq self-assigned this Jun 22, 2023
@create-issue-branch
Copy link

Branch issue-43 created!

@ElBe-Plaq ElBe-Plaq pinned this issue Jun 23, 2023
@ElBe-Plaq
Copy link
Member Author

After rewriting the identifier rule, development can continue

ElBe-Plaq added a commit that referenced this issue Jul 30, 2023
ElBe-Plaq added a commit that referenced this issue Aug 4, 2023
ElBe-Plaq added a commit that referenced this issue Aug 4, 2023
ElBe-Plaq added a commit that referenced this issue Aug 4, 2023
ElBe-Plaq added a commit that referenced this issue Aug 4, 2023
ElBe-Plaq added a commit that referenced this issue Aug 4, 2023
@ElBe-Plaq
Copy link
Member Author

Currently doing filtering stuff, just to give you an update,

@ElBe-Plaq
Copy link
Member Author

I will take a look at https://learning-rust.github.io/docs/custom-error-types/ for the error rewrite.

@ElBe-Plaq
Copy link
Member Author

I have decided not to use the pest provided pairs, but to make my own token struct and convert the pest types.

@ElBe-Plaq
Copy link
Member Author

When running the parser with the input var x=1\n the output is

[
    Token {
        token_type: Mark(
            Assignment,
        ),
        content: "var x=1",
        inner: Some(
            [
                Token {
                    token_type: Mark(
                        Variable,
                    ),
                    content: "var",
                    inner: None,
                    position: Position {
                        line: 1,
                        colon: 1,
                    },
                },
                Token {
                    token_type: Identifier,
                    content: "x",
                    inner: None,
                    position: Position {
                        line: 1,
                        colon: 5,
                    },
                },
                Token {
                    token_type: TypeDefinition(
                        Integer,
                    ),
                    content: "1",
                    inner: Some(
                        [
                            Token {
                                token_type: TypeDefinition(
                                    IntegerSign,
                                ),
                                content: "",
                                inner: None,
                                position: Position {
                                    line: 1,
                                    colon: 7,
                                },
                            },
                            Token {
                                token_type: TypeDefinition(
                                    Integer,
                                ),
                                content: "1",
                                inner: None,
                                position: Position {
                                    line: 1,
                                    colon: 7,
                                },
                            },
                        ],
                    ),
                    position: Position {
                        line: 1,
                        colon: 7,
                    },
                },
            ],
        ),
        position: Position {
            line: 1,
            colon: 1,
        },
    },
]

ElBe-Plaq added a commit that referenced this issue Sep 11, 2023
@ElBe-Plaq
Copy link
Member Author

This issue is now being used for multiple improvements, such as working on the parser or adding translations.

@ElBe-Plaq ElBe-Plaq changed the title [FEATURE] Add grammar [FEATURE] Add grammar, transltaions and better parser Sep 20, 2023
ElBe-Plaq added a commit that referenced this issue Sep 20, 2023
ElBe-Plaq added a commit that referenced this issue Sep 20, 2023
@ElBe-Plaq
Copy link
Member Author

I will add a pratt parser and more grammar in the future.

@ElBe-Plaq ElBe-Plaq changed the title [FEATURE] Add grammar, transltaions and better parser [FEATURE] Add grammar, translations and better parser Sep 20, 2023
@ElBe-Plaq ElBe-Plaq linked a pull request Sep 20, 2023 that will close this issue
13 tasks
@ElBe-Plaq ElBe-Plaq unpinned this issue Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant