Skip to content

Conversation

@diorcety
Copy link

@diorcety diorcety commented Jun 6, 2025

Based on PR #7, adding the support of defined variable inside memory origin / length

@pftbest
Copy link
Owner

pftbest commented Jun 7, 2025

Thanks @diorcety ! Although the PARSE_STATE in a thread local storage looks a bit strange to me. Have you considered just running the evaluation as a second pass over the Vec<RootItem> after the old parser finished? Or there is some special case where you need to know the results during parsing, and cannot delay it till the second pass?

@pftbest
Copy link
Owner

pftbest commented Jun 7, 2025

For example, extend the Region struct like this:

#[derive(Debug, PartialEq)]
 pub struct Region {
     pub name: String,
     pub origin: u64,
     pub length: u64,
+    pub origin_expr: Expression,
+    pub length_expr: Expression,
 }

And only write the expressions during parsing. Then on a second pass calculate origin and length based on that expressions.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants