News for hackers. Stuff that matters.
Re:Chumsky: A Tutorial by kaz-inc on Tuesday April 12, 2022 @02:04PM (#31006227)
There's a lot more to writing a compiler/interpreter than parsing, and I would almost posit that parsing is the _least_ interesting part of writing a compiler.
Re:Chumsky: A Tutorial by mamcx on Tuesday April 12, 2022 @04:49PM (#31008061)
That is what I thought before.

But what this library and some others are aiming for is the NEXT level of parsing difficulty: Parsers that work AND also provide high-fidelity output for SEVERAL consumers (IDE, editors, linters, ...) AND provide high-quality errors (aka: diagnostics) AND provide suggestion to fix that errors.

That is another level!

MUCH HARDER!

Re:Chumsky: A Tutorial by jjice on Tuesday April 12, 2022 @02:46PM (#31006760)
I agree that it's the least interesting part (at least for me), but a necessary part to be able to get to the juicy stuff. Getting a quick parser ready helps keep me wanting to code since I don't have to trudge though to get to the fun part.
Re:Chumsky: A Tutorial by xiphias2 on Tuesday April 12, 2022 @02:19PM (#31006441)
Can you tell any other part of the compiler ecosystem that helps you write a new programming language in 1 hour?

This is supposed to be a fun article for experimentation in programming languages, not a new advancement in a garbage collection algorithm for increasing the efficiency of a datacenter by 2%.

My favourite new programming language is Svelte for example (just a parser that emits javascript), it's just a little different from HTML/CSS/JS, but just enough to make web development fun again for me.

Re:Chumsky: A Tutorial by DylanSp on Tuesday April 12, 2022 @04:48PM (#31008053)
Rust already has Nom for parser combinators, though. This library looks fine (at first glance) for a parser library, but it doesn't seem like it helps with building languages beyond just parsing (which is what I expected from the title).
Re:Chumsky: A Tutorial by zesterer on Wednesday April 13, 2022 @05:37AM (#31012710)
The main points of focus for chumsky, beyond nom, are:

- Ease of use + ergonomics

- Backtracking 'by default'

- High quality errors and error recovery

Nom is very specifically designed for parsing input not intended to be read by humans, and that focus is evident in the things is prioritises.

Re:Chumsky: A Tutorial by charcircuit on Tuesday April 12, 2022 @06:56PM (#31009231)
LLVM
Re:Chumsky: A Tutorial by tekknolagi on Tuesday April 12, 2022 @02:26PM (#31006506)
The article implements eval() for a couple stages in the language. It's not just parsing.
Re:Chumsky: A Tutorial by DylanSp on Tuesday April 12, 2022 @04:46PM (#31008033)
I mostly agree, this just seems like a case of a weird description in the HN submission. As it is... it's a parser library, the Github project calls it a parser library, and that's fine.
Re:Chumsky: A Tutorial by zesterer on Wednesday April 13, 2022 @05:35AM (#31012702)
If it helps, I also have tutorials in the works for type inference & type-checking, monomorphisation, optimisation, and possibly codegen too.
Re:Chumsky: A Tutorial by junon on Tuesday April 12, 2022 @05:17PM (#31008332)
Yep. Getting the initial AST/CST is easy. Going from that to whatever your target is is the meat of the entire project.
Re:Chumsky: A Tutorial by postalrat on Tuesday April 12, 2022 @02:20PM (#31006450)
No where in the title or article did I read "compiler".
Re:Chumsky: A Tutorial by gnulinux on Tuesday April 12, 2022 @04:25PM (#31007820)
A programming language implementation is either a compiler or interpreter. Title says "write your own programming language..." which implies an implementation. But that's not the case. As other commenters point out parser is a tiny, usually inconsequential part of a lang implementation.
Re:Chumsky: A Tutorial by zokier on Tuesday April 12, 2022 @04:50PM (#31008079)
The article contains full interpreter?
Re:Chumsky: A Tutorial by gnulinux on Wednesday April 13, 2022 @03:43PM (#31019301)
I wouldn't call it a full interpreter, it just walks expressions' AST. No way to create class/abstractions.
Re:Chumsky: A Tutorial by mhh__ on Tuesday April 12, 2022 @03:57PM (#31007544)
Nearly all mature language implementations are compilers to some extent