I’m very happy here to announce that now Yaya can finally calculate simple arithmetic expressions (with correct precedence)!
I have almost completely forgot how to use stacks to evaluate infix expressions, and most tutorials online are not suitable for my special case. So it takes a while for me to figure out how to do it.
However after written this evaluation part I find out I can’t understand it again :( anyway at least it can actually work. Never mind let’s celebrate this great success!!!
(here is the core code of evaluation… can you understand it?)
Log in to leave a comment
A lot of work since last time!
When I started to write parser last time, I then genuinely fell down to a giant trap named expression. Indeed there are several well-developed ways on expression parsing, but my situation is really unique - in my language, the precedence of an operator can be resolved only at runtime. And this feature is very annoying…
So in the end, instead of start parsing directly, I choose to preprocess all the custom operator declaration first. After knowing which punctuations can be used as operators, the parser can process expressions more accurately - at least in my expectations.
What will happen next? Maybe we should just start coding before thinking.
Log in to leave a comment
A long time since the last devlog because of curricular issues.
Anyway, back again, here I am.
Since I’d created a complicated and messy syntax for my programming language Yaya, I had to take a lot of time on thinking which types of AST nodes are actually needed and which are not.
Writing AST nodes themselves were very tiring, so I wrote a simple script to generate AST nodes automatically from a sort-of description file. It works really well and saved me a lot of time.
Anyway, the next step should be syntactic parsing. There is still a long way to go…
(The quick expansion on LOC are all contributed by auto-generated AST nodes.)
Log in to leave a comment
Lexer is almost done!
Can’t expect I can write lexer this fast… but for the extensibility in the future, I actually give out a lot of accuracy on syntax, which accidentally boost my coding speed on writing a lexer.
Alright, let’s move on to the hardwork in parser… maybe?
Log in to leave a comment
Small fixes about specifications and struggling about the specific definition on token types. Bro why is this stupid specification still chasing me after.
It seems like my source codes would all be put in files like .hpp in the future. That’s indeed a great try for simplifying compile commands lol.
Actually seems nothing more than before…?
Log in to leave a comment
The very first version of the specification of Yaya is finally complete.
Writing documents are extremely painful… but at least there will be no more documents for a long time.
Now it’s the time for real coding.
Log in to leave a comment
The specification work took longer than expected… I thought it would be very easy, but the details had sneaked into every single corner. The specification is currently three times larger than the previous record in the devlog.
There will be more devlog about specifications until it’s finally complete.
Still cannot confirm when can start to write normal codes, not Markdown.
Log in to leave a comment
Well, actually this devlog is not about infrastructure again… but about specifications.
I wrote some simple regulations on a program written in my PL. Actually, the specification is even far from complete.
Writing specification is not fun… actually I used to write specifications for others, when writing a specification which has an already-made prototype, the experience is way more different from writing a specification from scratch.
Anyways, these documentary things are actually once and for all. After this there would be only less than one devlog about documents.
Log in to leave a comment
Everything starts small.
Though my ultimate goal is to make a programming language, but the basic infrastructure is also irreplacable. The standard library of C++ is not very handy, so I have wrote a few basic data structures (~700 loc) like strings with UTF-8 encoding, dynamic arrays, key-value storage based on AVL, and so on.
I still think the infrastructure is incomplete, so the next devlog should also be about basics.
Log in to leave a comment