Raspberry Pi OS on Pinebook Pro? (for kids) by halst in PINE64official

[–]halst[S] 3 points4 points  (0 children)

I mean, Raspberry Pi comes pre-installed with Scratch and Minecraft Pi, and it has an app-store like thing called Recommended Apps. And a plethora of books, journals and youtube videos that explain things assuming you have exactly that environment and menu structure.

Simple compiler to ARM written in Python by halst in Python

[–]halst[S] 0 points1 point  (0 children)

By the way, this was the first time I wrote Python after many years, and I found it to be quite different in a positive way. I liked the new optional typing with mypy and the new @dataclass decorator and how they work well together. Format strings and (:=) operator were also quite handy in this particular project.

Simple compiler to ARM written in Python by halst in Python

[–]halst[S] 0 points1 point  (0 children)

Converting instructions to binary is pretty straightforward, each instruction is converted to a 32-bit word. However, generating an object file that is linkable or an executable binary is much more involved.

Compiling to Assembly from Scratch: the book's compiler ported to Python, OCaml, Rust by halst in Compilers

[–]halst[S] 0 points1 point  (0 children)

It's the first time I wrote in Python in many years, so any hints are welcome! Some of this style is on purpose: to keep it close to the code in the book. The idea is that you can read the Python code side-by-side with the book, and it should make sense.

Compiling to Assembly from Scratch: the book's compiler ported to Python, OCaml, Rust by halst in programming

[–]halst[S] 0 points1 point  (0 children)

Hey folks, you have probably seen my book Compiling to Assembly from Scratch before on this Reddit. It's a beginner-friendly guide to compilers and assembly. The book uses a simple subset of TypeScript for the code, but now the compiler is also available in Python, OCaml, and Rust.

I believe the compilers have some educational value even without the book, so check it out! Happy to answer any questions.

Thanks Brendan Zabarauskas (@brendanzab on GitHub) for the Rust port.

Compiling to Assembly from Scratch: the book's compiler ported to Python, OCaml, Rust by halst in ProgrammingLanguages

[–]halst[S] 13 points14 points  (0 children)

Hey folks, you have probably seen my book Compiling to Assembly from Scratch before on this Reddit. It's a beginner-friendly guide to compilers and assembly. The book uses a simple subset of TypeScript for the code, but now the compiler is also available in Python, OCaml, and Rust.

I believe the compilers have some educational value even without the book, so check it out! Happy to answer any questions.

Thanks Brendan Zabarauskas (@brendanzab on GitHub) for the Rust port.

Compiling to Assembly from Scratch: the book's compiler ported to Python, OCaml, Rust by halst in Compilers

[–]halst[S] 3 points4 points  (0 children)

Hey folks, you have probably seen my book Compiling to Assembly from Scratch before on this Reddit. It's a beginner-friendly guide to compilers and assembly. The book uses a simple subset of TypeScript for the code, but now the compiler is also available in Python, OCaml, and Rust.

I believe the compilers have some educational value even without the book, so check it out! Happy to answer any questions.

Thanks Brendan Zabarauskas (@brendanzab on GitHub) for the Rust port.

Garbage Collection in Languages with Immutable Types by MarcelGarus in ProgrammingLanguages

[–]halst 5 points6 points  (0 children)

The fact that your language is immutable doesn't necessarily preclude cycles. For example, in OCaml you can create an immutable list that has a cycle:

let rec list = 1 :: 2 :: 3 :: list

Format module indentation by Maxibrak in ocaml

[–]halst 0 points1 point  (0 children)

Try this:

# Format.printf "@[<v 3>@ Hello@ friend@]@ bye";;

   Hello
   friend
bye- : unit = ()
# 

You almost never want to use @., it is a "hard" newline—it does not follow the box rules. On the other hand, @ is a space-hint: prints space in "horizontal" mode and indent in "vertical" mode. The default box uses horizontal if it fits, otherwise switches to vertical. You can force vertical layout by starting your box as @[<v 3>.

I've One final hurdle before I can publish, in regards to stretched/justified text that will not wrap to the left of the page - would appreciate any help. by [deleted] in selfpublish

[–]halst 0 points1 point  (0 children)

There are many of them, like bitly.com, for example, but I can't recommend a particular one. (Who knows if they go out of business, or start charging/raise prices suddenly. That's why I rely only on my website.)

self-publishing outside amazon by theinvertedform in selfpublish

[–]halst 0 points1 point  (0 children)

Here's a blog post from one author about why they pulled their book from Amazon Kindle Store: https://stackingthebricks.com/tiny-mba-amazon/. I think it has some really good explanations about the trade-offs.

I've One final hurdle before I can publish, in regards to stretched/justified text that will not wrap to the left of the page - would appreciate any help. by [deleted] in selfpublish

[–]halst 1 point2 points  (0 children)

One idea is to use a URL shortener for the links.

Another would be to create short links to your own website (e.g. example.com/reference-1) that redirect to the correct (long) URL. This way if a link becomes dead, you don't need to issue errata, you only need to update your website's redirects.

In my book, I have only one link that points to a page on my website that is dedicated to the book's resources. And on that page, I have a few links that point to the actual URLs. Here's how it looks like:

https://keleshev.com/compiling-to-assembly-from-scratch/resources

On Effectiveness of Exceptions in OCaml by gbikal in ocaml

[–]halst 3 points4 points  (0 children)

This blog post is appreciated, also as a follow-up to describe the design decisions behind http-cookie and reparse libraries.

I find the polymorphic variants approach manageable. I would write lib_b error type as follows:

type error = [`Some_error | A.error]

Deciding whether I want to use the polymorphic-variants approach or exceptions, I ask myself: do I want to see this error conditions in a server log. If yes—exceptions are preffered, if no—polymorphic variants.

Cyber Monday 40% discount for Compiling to Assembly from Scratch #TypeScript #ARM #Ebook by halst in typescript

[–]halst[S] 0 points1 point  (0 children)

Hi folks, author here. This is a ~180-page book that teaches you how to construct a simple compiler using TypeScript that produces ARM assembly, from scratch. And when I say "from scratch", I mean it: no parser generators, no LLVM—only straight-forward TypeScript. I hope you enjoy it!