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

Build parser for Rib import statements #1173

Open
afsalthaj opened this issue Dec 11, 2024 · 0 comments
Open

Build parser for Rib import statements #1173

afsalthaj opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels
Milestone

Comments

@afsalthaj
Copy link
Contributor

afsalthaj commented Dec 11, 2024

This is the first step to first class worker support in Rib

Build a parser for import statements with tests, and the first one that we would be supporting is just functions, and therefore the grammar can be quite biased to just importing functions. We will deal with importing any other types later

Grammar

import_statement = "import", function_name, ["as", identifier];

Grammar may differ as we go, to bring in component name (package) in it or not

We will reuse the parser for function_name.

It can get materialized into a module. For now we just assume its just a single module, but good to go on this route straight away. Import will not be considered as an Expr, as it can lead to hefty complexities such as InferredType

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Module {
  pub imports: Vec<Import>,
  pub expressions: Vec<Expr>, // Or statements, depending on design.
}

@afsalthaj afsalthaj self-assigned this Dec 11, 2024
@afsalthaj afsalthaj added the rib label Dec 11, 2024
@afsalthaj afsalthaj added this to the Golem 1.2 milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant