Live data from Hacker News

Lang Jam: create a programming language in a weekend

github.com

31–40 of 135 posts

Re: Lang Jam: create a programming language in a weekend

#31
post #28
post #27

Earlier quoted context omitted.

Why would someone write a bootstrapping rust compiler in C++ when you can just compile the rust to C using a proper llvm backend?

Bootstrapping on platforms where llvm isn't supported?

I don't see why you would want to do that as you can always ssh into a system where llvm is supported, then compile to C, copy the C sources back to your system and compile rustc using a C compiler.

Re: Lang Jam: create a programming language in a weekend

#32

As someone that writes a lot in Rust, I have a longstanding dream to make a compiler for a subset of the language, since I don’t use all features of Rust and my hope is that this way I could have fast debug builds (in terms of compilation time) while I develop, with simplified borrow checker and so on. So then I can iterate faster. That’s one of my dreams. But I have not had time to even look at it yet, as the other…

I don't think borrow checking plays a significant roles in most projects compiling performance. Running `cargo check` generally runs a lot faster (after the first run) than `cargo build`, even if it runs borrow checking, etc. AFAIR macro expansion, LLVM code generation and linking takes a lot of time, but it depends on the project.

In the perf site you can see some examples: https://perf.rust-lang.org/

Re: Lang Jam: create a programming language in a weekend

#33
post #31
post #28

Earlier quoted context omitted.

Bootstrapping on platforms where llvm isn't supported?

I don't see why you would want to do that as you can always ssh into a system where llvm is supported, then compile to C, copy the C sources back to your system and compile rustc using a C compiler.

Perhaps the generated C isn't as portable (endianess, byte alignment, etc).

Re: Lang Jam: create a programming language in a weekend

#34
post #30
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

Another "crazy" idea: I'd like the compiler to reformat code to match strict style conventions. Why? Sometimes there's no "right" style. Sometimes novices need training wheels. In the long run, style doesn't matter, but in big projects code is easier to read when style is consistent. It's also easier to onboard when code follows industry-standard styles. Would it be better when a language gently pushes everyone to th…

It's definitely been done before, Zig comes to mind immediately but I'm pretty sure it wasn't the first place I've seen it done first party.

Re: Lang Jam: create a programming language in a weekend

#35

As someone that writes a lot in Rust, I have a longstanding dream to make a compiler for a subset of the language, since I don’t use all features of Rust and my hope is that this way I could have fast debug builds (in terms of compilation time) while I develop, with simplified borrow checker and so on. So then I can iterate faster. That’s one of my dreams. But I have not had time to even look at it yet, as the other…

Any ideas on how one can simplify the borrow checker?

Re: Lang Jam: create a programming language in a weekend

#36
post #26
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

The usage of `unless` strikes me as unmaintainable and "smart", not in a good way tbh. The types are all other the places, too. What is it even doing exactly? Appending a string to a null value..?

As is it's just doing the first 100 iterations of fizzbuzz as either a number or text depending on the fizzbuzz step but not printing or saving anything. If you wrap it in a console.log() it'll create a 100 element array of objects which are the answer for fizzbuzz[index+1] and log them.

All that said I've never been a fan of dynamically typed languages myself. Fast to make things in but difficult to reason about later.

Re: Lang Jam: create a programming language in a weekend

#37
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

> What kind of language ideas do you folks have?

1. That would be telling.

2. Apparently there's going to be a theme? So that might make whatever wacky language I've been mulling a bad fit. I'm rather curious about how that will play out

Re: Lang Jam: create a programming language in a weekend

#38
post #31
post #28

Earlier quoted context omitted.

Bootstrapping on platforms where llvm isn't supported?

I don't see why you would want to do that as you can always ssh into a system where llvm is supported, then compile to C, copy the C sources back to your system and compile rustc using a C compiler.

How are you compiling to C? With the LLVM IR to C backend that was (is?) maintained by the Julia folks? My experience from a couple years ago was that it didn't produce output which would compile with baroque C toolchains for platforms that LLVM doesn't support... I'm giving very unsubtle side eye to you TriCore.

Re: Lang Jam: create a programming language in a weekend

#39

As someone that writes a lot in Rust, I have a longstanding dream to make a compiler for a subset of the language, since I don’t use all features of Rust and my hope is that this way I could have fast debug builds (in terms of compilation time) while I develop, with simplified borrow checker and so on. So then I can iterate faster. That’s one of my dreams. But I have not had time to even look at it yet, as the other…

I think you would be better served by a simplified, less optimized code generation, as from what I understand LLVM is the thing that takes a lot of time. You can see this pattern in Crystal and Swift for example, that also use LLVM and are also relatively slow to compile, compared to OCaml or Go which have their own backend.

Re: Lang Jam: create a programming language in a weekend

#40

As someone that writes a lot in Rust, I have a longstanding dream to make a compiler for a subset of the language, since I don’t use all features of Rust and my hope is that this way I could have fast debug builds (in terms of compilation time) while I develop, with simplified borrow checker and so on. So then I can iterate faster. That’s one of my dreams. But I have not had time to even look at it yet, as the other…

Any ideas on how one can simplify the borrow checker?

You could implement it as a runtime check
Post reply on HN