Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Basic PEG grammar for Stoffel Lang#42

Open
Mikerah wants to merge 26 commits intomainfrom
parser
Open

Basic PEG grammar for Stoffel Lang#42
Mikerah wants to merge 26 commits intomainfrom
parser

Conversation

@Mikerah
Copy link
Contributor

@Mikerah Mikerah commented Jun 6, 2022

I have a basic PEG grammar for StoffelLang along with some skeleton code for what the parser should do and to provide some more guidance of what the compiler's functionality should be. I haven't amended the honeybadgerswap examples as there is still some more thought that needs to go into the grammar.

Currently, the grammar doesn't support the following:

  • imports: Ideally, this will be added once we have the standard library and a corresponding example
  • maps: It's unclear whether maps should be included in the language as part of the grammar or the standard library or at all. Having keys be secret shared numbers would require the use of ORAM. As such, I have omitted this for the first version of the grammar.

@Mikerah Mikerah requested a review from th4s June 6, 2022 03:07
Copy link
Contributor

@th4s th4s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I haven't used pest before but it seems that this is exactly the right tool for developing a new language/grammar in Rust.

The pairs api seems to allow to iterate over the parsed tokens. I think this is where we will have to add our optimizations. After that we can start translating to VM bytecode.

@Mikerah
Copy link
Contributor Author

Mikerah commented Jun 9, 2022

I amended the HoneyBadgerSwap example to fit the current grammar. The last thing to add before converting this draft PR into an actual PR is some skeleton code for the parser.

@Mikerah Mikerah marked this pull request as ready for review June 11, 2022 23:27
@Mikerah Mikerah requested a review from th4s June 11, 2022 23:27
@Mikerah
Copy link
Contributor Author

Mikerah commented Jun 11, 2022

I have a more complete grammar, have amended the honey badger swap example further and added some skeleton code for the parser. With Pest, a lot of the code is auto-generated, so all that is need is to define enums/structs and use the corresponding derive macros.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants