globals support in nac3standalone #541

Closed
opened 2024-09-12 12:59:14 +08:00 by sb10q · 3 comments
Owner

This fails currently:

@extern
def output_int32(x: int32):
    ...

X = 0

def run() -> int32:
    output_int32(X)
    return 0
1 error(s) occurred during top level analysis.
=========== ERROR 1/1 ============
type error at identifier `X` (cannot get type of X) at src/assignment.py:8:18
==================================
thread 'main' panicked at nac3standalone/src/main.rs:375:9:
top level analysis failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This fails currently: ``` @extern def output_int32(x: int32): ... X = 0 def run() -> int32: output_int32(X) return 0 ``` ``` 1 error(s) occurred during top level analysis. =========== ERROR 1/1 ============ type error at identifier `X` (cannot get type of X) at src/assignment.py:8:18 ================================== thread 'main' panicked at nac3standalone/src/main.rs:375:9: top level analysis failed note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
Author
Owner

Also we want to be able to assign to globals, e.g.

def run() -> int32:
    global X
    X  = 34
    return 0

And they should be stored in the data segment and persist across calls of the run() function.

Also we want to be able to assign to globals, e.g. ``` def run() -> int32: global X X = 34 return 0 ``` And they should be stored in the data segment and persist across calls of the run() function.
Collaborator

The actual error for this is:

thread 'main' panicked at nac3standalone/src/main.rs:349:22:
called `Result::unwrap()` on an `Err` value: "registrations of constructs other than top level classes/functions are not supported (at src/globals.py:5:1)"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The actual error for this is: ``` thread 'main' panicked at nac3standalone/src/main.rs:349:22: called `Result::unwrap()` on an `Err` value: "registrations of constructs other than top level classes/functions are not supported (at src/globals.py:5:1)" note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
Author
Owner

Done

Done
sb10q closed this issue 2024-11-04 13:14:25 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#541
No description provided.