From 01ee6d3e1de75a1aa08afd06f4dafe49d099e77e Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 29 Sep 2021 20:32:00 +0200 Subject: cc: work on a working if --- miniany/REQUIREMENTS | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'miniany/REQUIREMENTS') diff --git a/miniany/REQUIREMENTS b/miniany/REQUIREMENTS index dd10d7e..cbee3f2 100644 --- a/miniany/REQUIREMENTS +++ b/miniany/REQUIREMENTS @@ -38,7 +38,7 @@ not implementing: - ASTs are basically only useful when you start to optimize, till then you can use an intermediate format (as C4) does and a stack machine. They also make the code easier readable. - For use they fore the introduction of pointers, references and structs. + For use they force the introduction of pointers, references and structs. In expression parsing we see, that const folding already needs an AST, because we should not emit code when still reading a constant expression. It also seperates syntactical stuff like '[' @@ -117,5 +117,14 @@ TODO: Inline assembly in the generated code duplicates code with the putint in libc-freestanding. - error output is not on stderr, well, are we going to add stdout, stderr now or do we write errors as sort of assembly comments? - +- AST debate: + - expressions really require an AST (just the A_ASSIGN itself with its reversed + order). IF, WHILE, etc. not, they can be in an AST or be endcoded directly (or if + not, what kind of optimizations do we loose?) + - the context of a boolean expression can be an if (in this case we would generate + direcly the jnXX instruction) and the far less often seen case of assigning it to + a variable. Knowing the contest would require an AST. + - AST should not be the output of whole programs, scoping is maybe better +- don't allow non-blocked if/else, just avoid dangling else problems + -- cgit v1.2.3-54-g00ecf