Closed YerinAlexey closed 3 years ago
Do we want to build 100% static binaries without any dependencies?
I think for now we can rely on the c stdlib as a dependency. Once the language is a bit more sophisticated, we can add our own wrappers.
Regarding assignment operators (+=): to keep it simple, we could maybe transform that during build-time to x = x + 1. Or how easy would that be to implement?
Regarding assignment operators (+=): to keep it simple, we could maybe transform that during build-time to x = x + 1. Or how easy would that be to implement?
This should be quite easy to implement. I had the idea to have a resolve(Expression) -> QbeValue
function that retrieves the value from variable, field access or array access and then use it in *Assign
binops.
It should be basically this (pseudocode):
let (ty, tmp) = resolve(lhs);
generate_assign(
lhs,
ty,
QbeInstr::Add(tmp, rhs),
);
Feel free to work on this in the meantime.
I rebased this on master, should still work
Any comments so far?
Also, would you mind opening some tickets for the missing parts? That way we have them documented to be worked on later
Also, would you mind opening some tickets for the missing parts? That way we have them documented to be worked on later
Ok, sure. I'll add arrays and += now, and leave match as a ticket. This PR is already massive
Description
This adds a generator for QBE. This time it should go a bit better.
Notes
ext*
instructionsDemo time
Produces:
Known issues
long
and pass it into something else, it will break. Blocked on better types and function prototype syntax.ToDo
+
,-
and friends)+=
,*=
etc)[..., ....]
initialization syntaxnew Database { ... }
)sb build
assemble and link the binary