-
Notifications
You must be signed in to change notification settings - Fork 0
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
Entry point and C main function #33
Comments
|
@sedwards-lab and I discussed adding a ref u8 parameter to the prototype of the main function, that would act as a sort of "stdout" to the program. So instead of This could be very useful for testing (both automated and manual), because it would effectively allow the user to print, using the language's existing capabilities. Of course, we can consider adding additional parameters; in particular, for standard input (CC @hmontero1205 ). |
How would this look in a program? Would this stdout 'handle' need to propagate from the entry point to any procedure that might write to it? It would be nice if we could do this while avoiding such boilerplate passing-around of that parameter. I am sure we can put something nice together. |
It depends on our variable scoping rules. I don't know that we have anything other that function parameters and function-local variables, but we could have global variables or perhaps even nested function declarations (a la Haskell). |
I already added support for global variables on one of my branches (the one with the led/button example, those variables are declared globally). I could try to make a pr with just that change if you'd like to take a look? :) |
We already know the entry point of the SSM program based on what is passed to
compile
. And that entry point should be invoked in the Cmain
function to put it in the continuation queue, before callingtick
for the first time.There are two related questions to discuss:
1. Where should the
main
function be? Should it be generated from the Haskell codegen, as we currently do for thetrace
platform, or should it be part of the platform code? I'm an advocate for the latter approach, since there's a lot of platform-specific boilerplate involved, but relatively little SSM program-specific information.2. What should the interface to the SSM entry point look like? As in, what should its type signature be? The simplest answer would be to keep it as
SSM ()
, which is whatcompile
already expects. But this doesn't support any kind of arguments or return value, which are primitive but valuable ways of interfacing with the environment.The text was updated successfully, but these errors were encountered: