Comments (5)
"a little writeup"
from prog8.
Oh well...
from prog8.
@meisl a little history: I read a few articles by Federico Tomassetti about antlr and kotlin ast's, I think one of them was https://tomassetti.me/parse-tree-abstract-syntax-tree/ and that put me on the way of the 'toAst()' extension methods. They've since stuck as the mechanism to get the kotlin ast classes from the antlr syntax tree.
Finally, there's this https://github.com/Strumenta/antlr-kotlin/ but it's still experimental . It could perhaps be used to remove the antlr java parser code and replace it with kotlin parser code directly -- but we still want to convert the antlr syntax tree to our own specialized ast classes.
from prog8.
IStringEncoding
is no longer part of the CompilerAst (actually, in 7.2, it has now been moved to a new module containing a bunch of compiler related interfaces that are shared over other modules. CompilerAst is NOT among those btw)- the containing module is not needed as global state to get the position from- these are extracted from the stream that the parser is reading from
from prog8.
while the complex "compiler Ast" as discussed above is still generated from the antlr parser, there is now also a new lightweight "codeAst" that is meant to be used in the codegenerator (this still has to be built)
So the idea is that the compilerAst is going to be internal to the compiler and optimizer phases and is no longer needed/visible in the codegenerators.
The new simpler Ast can be constructed incrementally by adding child nodes to incomplete parent nodes.
The compiler right now and the optimizers have way too much dependencies on the old Ast classes still, so replacing that by the new Ast completely is a bit too much for now, but maybe this can be done in the future to simplify things there as well.
from prog8.
Related Issues (20)
- Empty subroutine is removed in optimization phase even if it's referenced HOT 3
- update petscii tables with recent box drawing changes from cbmcodecs2?
- allow str in subroutine signature HOT 1
- consider using KoTest as test library
- Turn the httpCompilerService into an actual languageserver for prog8
- Weird type error when casting const HOT 5
- implement -D option as 64tass HOT 6
- move stack locations user defined HOT 11
- Can 't use e.g. c64.GETIN() in expression HOT 1
- add seeding functions for the various RNGs HOT 1
- improve docs on syntax of if etc
- Adding words in memory address causes IllegalArgumentException HOT 1
- Shifting a ubyte more than 7 bits silently optimizes to a no op in non-simple cases HOT 2
- Cannot negate byte in array HOT 3
- code gen missing for float negate in array (6502 target)
- Function calls in expressions may trash evaluator state HOT 2
- Internal error with float increment via typecast HOT 2
- Identical consecutive writes (wrongly) removed by compiler HOT 6
- Is there a way to create a custom target without forking the compiler? HOT 2
- write something about no conditional compilation in docs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prog8.