mirror of https://github.com/tbklang/tlang.git
⚡ Feature: Emit-C #50
Labels
No Label
dependency
emit
hashmapper
lebanonmapper
lexer
meta
needsfix
parser
qol
question
resolution
typing
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 1 hour 35 minutes
Due Date
deavmi
1 hour 35 minutes
Dependencies
No dependencies set.
Reference: tlang/tlang#50
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Behaviour-C
This is a living document describing what needs to be taken care of in terms of the generated C code and what implied aspects of C's behaviour are to be taken note of explicitly.
Function calls
C has underspecified behaviour when it comes to function call argument evaluation ordering. In fact it is known, through my own research project I conducted that the following C code will give differing results between
gcc
andclang
:This produces
5
ingcc
(right-to-left) and4
inclang
(left-to-right).We should analyse dgen.c's function call emit code and preinline the arguments to ensure we don't have underspecified behaviour (enforcing left-to-right)!
Todo
vardec_varass_dependencyto feature/behavec_preinlineEmit-Cto ⚡ Feature: Emit-CWorking on tabbing the generated code out nicely now...
I have something working but it still looks a little bit. Here is the output code (it does look better though):
For reference the input TLang code was:
I know exactly what it is. The
emitFUnctionDefinition(string)
will tab each emitted instruction but these are notInstruction
s but strings, so what would have been padded is now wrongly padded. I will look into the cleanest way to solve this soon.Updated with latest code from
vardec_varass_dependency
. The code coverage should be higher now. 👍This should be finished prior to #157 as I want to get these changes in and upstream them into that issue's branch, rather than deal with many merge conflicts later.