Si vous vous ennuyez durant ce jour de congés et avez envie de discuter un peu autour d'un peu de code en #Pascal je vous propose deux streams sur #Twitch.
Some compiler routines such as sizeof() need to be able to handle a type name as a parameter, for example sizeof(Integer).
I've added a type called TypeDef to handle this. When the parser hits an identifier which is a type name but not a typecast it returns a value of type TypeDef.
Almost all the code generation is table driven. Inc and Dec are one of the exceptions that require code. In this case it's a loop to generate the INC or DEC instructions.
Only thing left to do is to generate add or subtract if the offset is too large. For now I'm stabbing at doing this for offset greater than four. Optimising here is much more complex than it might seem. For example you can INC any register whereas ADD requires A.
The Odd operator is beautifully easy after Inc and Dec. I've highlighted to two instructions for the Odd itself and the CPL for NOT. Ignore the references to temp0 which will get optimised away at some point.
Note how the allocator is smart enough to only load the low byte of the 16-bit variable.
I think I'll also add a version that targets a branch. It'll be a lot shorter if optimised.
I'm working my way through 'intrinsics' in the #compiler. These are operations that look like functions or procedures to the programmer but are generated inline code. Examples are Write, Inc, Peek, Poke, Inp, Out, Sizeof and High.
Support for these includes adding an 'Enumerable' type set for the parameters and some flags. Inc and Dec can only accept a variable reference as the first parameter and a constant as the optional second parameter.
Знову був срач із серії - #Python це кал, переходь на (тут список здебільшого зумовлений, мабуть, психологічними травмами як у Індіани Джонса, якщо хто зрозумів про що я).
Я не різнобічний у калознавстві, але найкращий стек технологій це той, який ти знаєш.
При його знанні та закриваючи прогалини в ньому за допомогою ШІ можна зробити макет практично будь-якого проєкту щоб показувати його в пошуках фінансування.
Зробити за добу, щоб хоч якось працювало, та за тиждень, щоб було несоромно показати.
@alexcleac У мене першою мовою був #basic на синклері з 48 кіло пам'яті. Потім був #pascal на 286 процесорі. Після - #assembler. Після я довго мучився з чим завгодно (наприклад #geant - отка екзотика), поки не знайшов #python, який завдяки потужному залізу (а воно зараз на тлі 48к усе потужне) річ узагалі не вбивається. Але в улюбленому геймдеві марна. Хоча якщо міць наростять, а її наростять, то ще подивимося.
Стоп. Я ще кодив на калькуляторі МК52, тож було життя і до бейсіка.
I'm adding typecasts to the #Quiche#compiler. This is the next step toward full function support. In #Pascal typecast syntax is the same as a function.
b := integer(a);
This gives me the hooks I need to call functions within expressions and handle the return value. But typecasts generate inline code so I don't have to do stack frames yet.
Leider wusste ich in den 90ern nicht, dass #basic bei DOS dabei war - ich hatte nur die „Shell“-Programmierung mit GOTO und IF ERRORLEVEL gefunden und bin damit schnell an Grenzen gestoßen
#pl1, #pascal , #Cobol, #fortran waren damals richtig gute Sprachen. Zumindest war der Code im Nachhinein noch lesbar und einigermaßen nachvollziehbar.
I also like linguistics, math, sudoku, low-level programming, conlangs and conscripts, typography, compiler design, operating systems, politics and contemporary history.
Hello! I am Ștefan (you can use your native language's Stephan equivalent).
I am interested in (computational) #linguistics, {natural,constructed} x {languages,scripts}, contemporary history, #typography (#texlatex ftw), compiler and programming language design, low-level programming, #astrology, #deism, #politics and operating systems among other things.
lukewarm take (had this talk in private with @mia but I have to share this):
#Rust is the best thing to happen to #Ada and they should be used a lot more (especially Ada). Moreso, I believe that Rust is essentially FP Ada with C syntax.
Now let me cook (this will be a multi-toot series). Ada, like Rust, is extremely type safe and stringent (they reach memory safety through different paradigms, but they end up having equivalent levels of memory safety).
Ada is more procedural/OO while Rust is more functional, from that POV they fit together perfectly. They're both fast languages with a lot of checks.
Rust can benefit from what we Ada people have with #SPARK and actually be able to prove that your program does what it says without a shadow of a doubt (SPARK is so good that it overshadows #MISRA C which is the gold standard for critical software made in C).
Ada can use Rust's popularity in open source and community (ideally not a toxic one at times), Rust can use Ada's proven track record of handling mission-critical tasks with no compromises whatsoever.
Ada can use Rust's successful marketing (holy shit does #AdaCore need to get involved more), Rust can use the lessons that Ada learned in its 40+ years of existence and improve upon them.
Rust can definitely benefit from having 1. an actual specification and 2. getting rustc certified (which would mean LLVM by extension), but those are behemoths and it's extremely unlikely, impossible even to audit. Lack of advertising leads to misconceptions, and misconceptions lead to not using the language (I use Tcl and Perl, so I definitely know how it feels to use languages that have been osbourned for 2+ decades).
@a13cui Thank you for these interesting posts! Although there is at least one other dimension I think you missed, and that is language stability. Rust changed A LOT and is still changing a lot and that is a no go for any serious commercial application. Combined with serious issues in the Rust leadership, as a company I would never use this language, not even for free.
The only overlap between these two languages is their focus on memory safety, but that's about it (in my naïve, unfounded opinion).
The only reason why Rust might seem interesting is that companies have access to a bigger Rust developer workforce, which is very small in the Ada world.
I was on a party last week and met two guys. One was 80 years old and still working in a company as a #Fortran developer. The other one was 65 years and still working as a #Pascal (Delphi) developer. Both work on serious industrial applications. It was a real joy to talk with them about how important language stability and longevity is.