Skip to content
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

LLVM IR generation #4

Merged
merged 34 commits into from
Apr 26, 2019
Merged

LLVM IR generation #4

merged 34 commits into from
Apr 26, 2019

Conversation

pilif0
Copy link
Owner

@pilif0 pilif0 commented Jan 11, 2019

This feature generates LLVM IR from the parsed AST.

@pilif0 pilif0 self-assigned this Jan 11, 2019
@pilif0
Copy link
Owner Author

pilif0 commented Jan 15, 2019

The question whether order of definitions in a program should matter was so far undecided, and delegated to this point where I know more about how the code is generated.

Consider the program:

x = 1;
y = x;
x = 2;

If the order of variable definitions (which all these are by the language definition) didn't matter, the value of y would be ambiguous.

Moreover, consider replacing y = x; with f () { return x; }. Then, by the same reasoning, order also matters in mixed definitions.

However, if the order of purely function definitions doesn't matter, no such ambiguity is present.

Therefore, at least for now, my decision is to make order of all definitions matter. The disruption this has for function definitions can be circumvented by adding function prototypes to the language.

The other option would be to make the order of definitions not matter, except some special cases. To me, having special cases like this seems like asking for trouble.

This issue could be solved later, for example by properly differentiating variable definition and assignment, and not allowing redefining. I will therefore re-examine whether this constraint could be lifted when the language is more mature.

@pilif0
Copy link
Owner Author

pilif0 commented Jan 20, 2019

Force-push was done because of an unpushed commit amend couple commits back (removal of last build function pointer from program codegen)

@pilif0 pilif0 merged commit 078aea0 into master Apr 26, 2019
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.

None yet

1 participant