ssm-lang / Scoria

This is an embedding of the Sparse Synchronous Model, in Haskell!
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Global references #50

Closed Rewbert closed 2 years ago

Rewbert commented 2 years ago

Some example of global references. I will test this a bit more when I get time this week (technically still on vacation), and will then request @j-hui to review the changes. I will also need to go over the code I wrote to make sure there are no 'hacks' left that I need to reimplement better, so read it with some discretion.

Rewbert commented 2 years ago

@j-hui you can take a look when you have time, perhaps? I've not added any testing machinery for this as it seems pointless to add it before your new system has been merged. I've added some manual prints to the interpreter at least, to make sure that the interpreter is behaving as it should. These prints have been removed in this PR though.

There's now support for writing programs that can contain global references that exist outside of an activation record. C: They are placed in the global scope and then initialized in a function void initialize_global_references(void), which is called by main. Interpreter: The main interpret state contains a map from variable names to references, and a process can look up a global reference in this map.

I think we can use this stuff to control standard streams from the EDSL.

Rewbert commented 2 years ago

I now modified the generator to generate programs that use anywhere from 0 to 5 global references, of random types.

Rewbert commented 2 years ago

closed since #64 contained the same work.