-
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
Add global variables to symbol table #101
Comments
typedefs should happen before top level expressions (globals) are evaluated (because our ast separates typedefs from expressions so we don't know whether a particular expr came before a typedef). However, function calls are allowed to reference these globals as long as the globals happen before the function is called.
|
I think we should go with the first one — don't allow function calls in typedefs. If we do 2nd one, it becomes pretty non-obvious why this code is wrong:
Also there's no way to enforce "no global variables" (aka "pure functions only") if you can call out to C++ — for example, F could be rand() or some arbitrary C++. Then F could return something different every time you Implementation: it may be easier to enforce this at the grammar level rather than in the type/semantic checker. |
ok we will go with the |
meant to say first, not second option lol |
closed by #109 |
@el2724 pointed out while looking at #100
The text was updated successfully, but these errors were encountered: