mirror of
https://github.com/irmen/prog8.git
synced 2025-02-19 11:31:07 +00:00
comments
This commit is contained in:
parent
0e824c35cc
commit
08e052380a
@ -10,6 +10,9 @@ import java.io.CharConversionException
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.io.path.Path
|
import kotlin.io.path.Path
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Semantic analysis.
|
||||||
|
*/
|
||||||
internal class AstChecker(private val program: Program,
|
internal class AstChecker(private val program: Program,
|
||||||
private val errors: IErrorReporter,
|
private val errors: IErrorReporter,
|
||||||
private val compilerOptions: CompilationOptions
|
private val compilerOptions: CompilationOptions
|
||||||
|
@ -16,6 +16,7 @@ import prog8.compilerinterface.IStringEncoding
|
|||||||
|
|
||||||
|
|
||||||
internal fun Program.checkValid(errors: IErrorReporter, compilerOptions: CompilationOptions) {
|
internal fun Program.checkValid(errors: IErrorReporter, compilerOptions: CompilationOptions) {
|
||||||
|
// semantic analysis to see if the program is valid.
|
||||||
val parentChecker = ParentNodeChecker()
|
val parentChecker = ParentNodeChecker()
|
||||||
parentChecker.visit(this)
|
parentChecker.visit(this)
|
||||||
val checker = AstChecker(this, errors, compilerOptions)
|
val checker = AstChecker(this, errors, compilerOptions)
|
||||||
|
@ -35,7 +35,6 @@ Ast modifications done in AsmGen, that should be done BEFORE calling asmgen (so
|
|||||||
and pass that via a new datastructure to asmgen? So that asmgen is no longer tasked with doing the allocations.
|
and pass that via a new datastructure to asmgen? So that asmgen is no longer tasked with doing the allocations.
|
||||||
This could perhaps make it easer for the codegen as well to deal with sections, if any, in the future.
|
This could perhaps make it easer for the codegen as well to deal with sections, if any, in the future.
|
||||||
|
|
||||||
|
|
||||||
- remove support for old @"screencodes" string encoding syntax (parser+code+docs)
|
- remove support for old @"screencodes" string encoding syntax (parser+code+docs)
|
||||||
- allow "xxx" * constexpr (where constexpr is not a number literal), now gives expression error not same type
|
- allow "xxx" * constexpr (where constexpr is not a number literal), now gives expression error not same type
|
||||||
- unify FunctioncallExpression + FunctioncallStatement and PipeExpression + Pipe statement classes, may require moving Expression/Statement into interfaces instead of abstract base classes
|
- unify FunctioncallExpression + FunctioncallStatement and PipeExpression + Pipe statement classes, may require moving Expression/Statement into interfaces instead of abstract base classes
|
||||||
@ -73,6 +72,7 @@ More optimization ideas
|
|||||||
- when a for loop's loopvariable isn't referenced in the body, and the iterations are known, replace the loop by a repeatloop
|
- when a for loop's loopvariable isn't referenced in the body, and the iterations are known, replace the loop by a repeatloop
|
||||||
- automatically convert if statements that test for multiple values (if X==1 or X==2..) to if X in [1,2,..] statements, instead of just a warning.
|
- automatically convert if statements that test for multiple values (if X==1 or X==2..) to if X in [1,2,..] statements, instead of just a warning.
|
||||||
- rewrite expression tree evaluation such that it doesn't use an eval stack but flatten the tree into linear code that uses a fixed number of predetermined value 'variables'?
|
- rewrite expression tree evaluation such that it doesn't use an eval stack but flatten the tree into linear code that uses a fixed number of predetermined value 'variables'?
|
||||||
|
"Three address code" was mentioned. https://en.wikipedia.org/wiki/Three-address_code
|
||||||
these variables have to be unique for each subroutine because they could otherwise be interfered with from irq routines etc.
|
these variables have to be unique for each subroutine because they could otherwise be interfered with from irq routines etc.
|
||||||
- this removes the need for the BinExprSplitter? (which is problematic and very limited now)
|
- this removes the need for the BinExprSplitter? (which is problematic and very limited now)
|
||||||
and perhaps as well the assignment splitting in BeforeAsmAstChanger too
|
and perhaps as well the assignment splitting in BeforeAsmAstChanger too
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
word w1 = 10
|
word w1 = -10
|
||||||
byte bb = -2
|
byte bb = 2
|
||||||
w1 *= bb
|
w1 -= bb-1
|
||||||
txt.print_w(w1)
|
txt.print_w(w1)
|
||||||
txt.nl()
|
txt.nl()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user