Remarkable that Bill is interested in a version of Oberon-07. It's even more minimalistic than the previous Oberon versions. I spent a lot of time with the original Oberon language versions and experimented with extensions to make the language more useful for system programming (e.g. https://oberon-lang.github.io/ and https://github.com/rochus-keller/oberon/ ). Eventually I had to give up backward compatibility to ge…
Please note the project isn't even 24 hours old yet. But I am using Oberon-07 as base, and I might deviate from it quite soon too. But I won't be going in the direction of things like Oberon+ (which adds generic and OOP programming) or Micron which adds the entire type system necessary to interact with foreign code. I just wanted something to explain to people how to do tokenizing, parsing, semantic checking (not jus…
The Titania Programming Language
51–60 of 68 posts
Re: The Titania Programming Language
#52Having done a fair degree of programming in Wirthwhile languages, I think the only main design decision that I think was a mistake was the variables at the top. I'm not sure of the value of seeing all of the variables used listed in one place, it has certainly led to me encountering a identifier scrolling up to determine the type then scrolling back down. When the variable is only used on a few consecutive lines it's…
When I write the backend (this repo isn't even 24 hours old yet), you'll find out why variable declarations are at the top of a procedure. (Hint: it has something to do with the stack).
I always thought there must be a better solution, like emitting the compiled function body first which just increments the offset whenever a space for a variable is required and emit the function entry after the function exit last, so you can set up the stack frame with full knowledge of it's use. Then the entry can jump to the body. Scoping to blocks would let you decrement the offset upon exiting the block which would result in less stack use which would almost always be more beneficial than the cost of the additional jump.
Re: The Titania Programming Language
#53Re: The Titania Programming Language
#54We need more context. Why Odin's creator created yet another programming language?
Matz has Streem, SPJ is working on Epic's new language, the creator of Pony is working on MS' project Verona, probably lots of others. Doubt it will supplant Odin though, considering Odin's being used professionally.
Re: The Titania Programming Language
#55We need more context. Why Odin's creator created yet another programming language?
> This is designed to be a language to teach compiler development with.
That is, this is the language a student would implement a compiler for. It's in line with what you'll find for most undergraduate compiler courses in terms of complexity.
Re: The Titania Programming Language
#56Earlier quoted context omitted.
Trying to eliminate semicolons by doing JS-style ASI is gross and complicates things unnecessarily. You can trivially change the parser/grammar so that the semicolons in import, var, procedure, etc. declarations just aren't required, and likewise with statements that end in "end". They'll still be necessary for statements comprising things like assignments and procedure calls, but for a teaching language who cares. (…
I only added that a few minutes ago, and it's a question of whether I should or not. This project is so goddamn new that I have not even decided anything. I was not expecting anyone posting this to HackerNews in the slightest. Also this isn't JS-style ASI technically speaking, and it won't have any of the problems either. The syntax for this language is different enough that it won't be a problem. Procedures don't ev…
> Procedures don't even return things
Oberon allows return values from functions (which are still declared with the PROCEDURE keyword). It looks like the same is true in Titania:
proc_body = decl_sequence ["begin" stmt_sequence] ["return" expr] "end".
https://github.com/gingerBill/titania/blob/085b7b5bcf7f06076...>I'm curious what you're going to do with the code generator. Parsers are easy and can be completed in a day or two. Even with a reference implementation, however, it's the backend that's a slog.
Re: The Titania Programming Language
#57Remarkable that Bill is interested in a version of Oberon-07. It's even more minimalistic than the previous Oberon versions. I spent a lot of time with the original Oberon language versions and experimented with extensions to make the language more useful for system programming (e.g. https://oberon-lang.github.io/ and https://github.com/rochus-keller/oberon/ ). Eventually I had to give up backward compatibility to ge…
Please note the project isn't even 24 hours old yet. But I am using Oberon-07 as base, and I might deviate from it quite soon too. But I won't be going in the direction of things like Oberon+ (which adds generic and OOP programming) or Micron which adds the entire type system necessary to interact with foreign code. I just wanted something to explain to people how to do tokenizing, parsing, semantic checking (not jus…
I am curious about your thoughts on var parameters (i.e. mutable references), as in:
proc increment(var x: int)
begin
x := x + 1
end
var i: int
begin
i := 10
increment(i) // i is now 11
endRe: The Titania Programming Language
#58Earlier quoted context omitted.
I only added that a few minutes ago, and it's a question of whether I should or not. This project is so goddamn new that I have not even decided anything. I was not expecting anyone posting this to HackerNews in the slightest. Also this isn't JS-style ASI technically speaking, and it won't have any of the problems either. The syntax for this language is different enough that it won't be a problem. Procedures don't ev…
I'm referring to the semicolon insertion described in the README as, "When a newline is seen after the following token kind, a semicolon is inserted". > Procedures don't even return things Oberon allows return values from functions (which are still declared with the PROCEDURE keyword). It looks like the same is true in Titania: proc_body = decl_sequence ["begin" stmt_sequence] ["return" expr] "end". https://github.co…
As for code generation, direct machine code to a Windows AMD64 PE executable.
Backend should not be that difficult because I am not working on anything complex nor optimizing. This won't be an optimizing compiler backend course.
Re: The Titania Programming Language
#59Earlier quoted context omitted.
When I write the backend (this repo isn't even 24 hours old yet), you'll find out why variable declarations are at the top of a procedure. (Hint: it has something to do with the stack).
I'm aware that it lets you do things in a single pass manner, but this is the instance where I think the cost for allowing that is too great. I always thought there must be a better solution, like emitting the compiled function body first which just increments the offset whenever a space for a variable is required and emit the function entry after the function exit last, so you can set up the stack frame with full kn…
But this is not meant to be a fully fledged language, it's meant to be a teaching tool. If you want a fully fledged language that allows for out of order declarations, try Odin!
Also, the syntax of Oberon/Pascal doesn't really allow for it in a nice way. It kind of looks really weird when you allow for it out of order.
Re: The Titania Programming Language
#60Having done a fair degree of programming in Wirthwhile languages, I think the only main design decision that I think was a mistake was the variables at the top. I'm not sure of the value of seeing all of the variables used listed in one place, it has certainly led to me encountering a identifier scrolling up to determine the type then scrolling back down. When the variable is only used on a few consecutive lines it's…
Wirth was obsessed with the idea of creating the absolutely minimal useful language, and many of his languages' warts come from that. Variables are at the top because: - you immediately see them (so, perhaps, easier to reason about a function? I dunno) - the compiler is significantly simplified (all of Wirths' languages compile superfast and, if I'm not mistaken, all are single-pass compilers) However, I feel that Wi…