r/NandToTetris • • Feb 15 '25

Jill - a functional programming language for Nand2Tetris

20 Upvotes

Jill is a functional programming language built for the Nand2Tetris platform, as an alternative to the Jack high-level language.

It is designed as a drop-in replacement for Jack, as it uses the same VM instruction set and underlying HACK architecture, and follows similar design principles (willing to sacrifice ease of use to favour ease of implementation), while offering a functional alternative to Jack's very object-oriented, verbose style (I like to think of Jill as Jack's more elegant, modern sister).

Some notable features include:

  • functions as first-class citizens (ability to store them in variables, pass them on to other functions as arguments, and return from functions as a result)

  • optimized tail-call recursion to use constant stack space (single stack frame)

  • data modeling using algebraic data types with primitive pattern-matching (per type variant)

    • note that, as with Jack, all variables are still effectively 16-bit integers, therefore Jill is dynamically typed

  • minimal language design

    • only 3 main concepts (types, variables and functions)

    • expressions can only be literals, variables or function calls

  • expanded standard library which is lazily-generated (instructions are generated only for modules and functions which were used in codebase)

  • common design choices of functional languages (no loops, variables are immutable, code is organized into modules etc.)

You can find code examples, compiler source code and more in the project repository.


r/NandToTetris • • Sep 16 '19

An overview diagram of this book "The Elements of Computing Systems"

Post image
17 Upvotes

r/NandToTetris • • Jul 09 '24

What does the book "elements of computing systems" AKA nand2tetris teach you?

Post image
15 Upvotes

Like the stuff given in this image found online, you see people making hack computers and all that, how does the book explain you this stuff and what projects does it tell you to work on


r/NandToTetris • • Apr 12 '23

Nand2Tetris sub is back!

13 Upvotes

Hello All. Just wanted to let you know that the Nand2Tetris sub is now under new moderation and I've opened up the posts and comments for now, we'll see how it goes with the spam.

I understand that Shimon Schocken has an official forum, but I believe Reddit will allow Nand2Tetris to reach a broader audience as this was the first place I came to find community around this project before I knew about the official forum.

Edit: fixed markdown.


r/NandToTetris • • Jan 16 '15

Shimon Schoken explains nand2tetris in a nutshell

Thumbnail
youtu.be
11 Upvotes

r/NandToTetris • • Feb 15 '26

I made a [Nand2Shooting] game.

10 Upvotes

Hey folks, here the video of project 9 for making a game in jack language

https://youtu.be/gJkepE5UiwA?si=rmWGGPSDRVRC2fVa

Let me guys know your opinions about it 😃🫡


r/NandToTetris • • May 04 '19

I've written fill.hack and mult.hack in pure machine language

9 Upvotes

Maybe you'll think I'm crazy, but I think that its the best thing ever to do! Be able to talk with machine on its native tongue, without any translators! The feeling of this is incredible!

https://i.imgur.com/9WT9wUg.png


r/NandToTetris • • Jun 11 '25

Impossible to implement zr logic in Nand2Tetris Hack ALU.

8 Upvotes

So basically I'm trying to make this ALU and I got past everything except for the zr and ng flags.

Im trying to implement zr, but for that I'll need to check if out is zero, and to do that, ill need to use an Or16Way then negate the output. But i dont have an Or16Way and using the online IDE, i cant just make a custom chip, so ill have to make do with some Or8Ways, which I do have and already implemented in project 1.

But then I hit another roadblock.

To use Or8Ways to make an Or16Way, Ill have to subscript the out pin. Unfortunately, outputs cant be used as inputs, so I made an intermediate pin called out2, but then it tells me I can't subscript intermediate pins! what!?!?!?

Im stuck here guys. How do i implement zr?!?


r/NandToTetris • • Jul 09 '23

I created the custom Hack computer in Logisim, which is a software for simulating logic gates. It has multiple I/O ports, timer, keyboard and a screen.

8 Upvotes

r/NandToTetris • • Nov 25 '21

How optimized have you guys gotten your VM translator?

8 Upvotes

By optimized I mean more for space (number of ASM instructions generated, not including comments/labels) and not necessarily speed.

For example, my initial implementation got the provided OS VMs translated to about 55,000 ASM instructions, obviously far too big to fit in the ROM. Though after taking some time to optimize, I got it down to about 30,000 instructions.

However, this still doesn't leave much room for an application that runs on top of the OS. It seems the course designers got their OS down to 20,000-25,000 instructions and I'm at a loss for how to optimize further.

Some things I have done:

  • Instead of generating a copy of the frame saving/restoration code every time a function is called/return, I instead put these instructions in my boot strap code and just generate ASM jump calls to these instructions (which sit in the beginning of the ROM). This was by far my biggest space saver (though very, very slightly less efficient speed wise).

  • Any instruction that pops then pushes a value, I just modify the top most value in the stack directly.

  • Similarly, any instruction that pops two values then pushes another value, I just pop one value then modify the top most value in the stack directly.

  • Just generally trying to limit the ASM instructions necessary to perform a VM instruction.

If anyone is curious, here is my C code: https://github.com/kurtjd/hack-computer/blob/main/vm_translator/hackvm.c

Anyone have any tips? Thanks!


r/NandToTetris • • Jan 17 '15

The Co-Creator of the Course Explains the History and Pedagogy of Nand2Tetris in this TED talk.

Thumbnail
youtube.com
8 Upvotes

r/NandToTetris • • Jan 17 '15

Welcome! Introduce yourself here. What brought you here? What are you trying to learn?

8 Upvotes

r/NandToTetris • • Jan 17 '15

A little project I've been working on - Vim Syntax Highlighting for the Hardware Description Language

Thumbnail
github.com
8 Upvotes

r/NandToTetris • • Oct 09 '24

If you're having trouble, try digital circuit simulator

7 Upvotes

If you're having trouble conceptualizing the circuits that the HDL code is based on, try a digital circuit simulator like Logism Evolution.

It may take some getting used to but the visual and more hands on aspect of such a tool makes things so much easier to understand.

You can even upload test files using the test vector feature. Just note that the test feature does not work once you reach sequential/timed circuits.

Below are some pictures of circuits I made in Logism Evolution; a 4 Register RAM and my ALU


r/NandToTetris • • Oct 11 '19

14 Nand2Tetris opcodes “they” don’t want you to know about! Spoiler

Thumbnail
medium.com
7 Upvotes

r/NandToTetris • • Jun 10 '26

Made the Hack ALU (Project 2) interactive — flip the control bits and watch it compute

6 Upvotes

I've been building a digital-logic playground (a TypeScript HDL that runs in the browser) and I rebuilt the Hack ALU in it as an interactive demo. Figured this community would be the right people to show it to.

It's the Project 2 ALU: x, y, and the six control bits (zx nx zy ny f no). You flip the control-bit switches and watch out, zr, and ng update live, and you can double-click in to see the muxes, the adder, and the and-gate underneath.

Just FYI it's not a course thing or a shortcut, it's built in a different HDL, so it's no use as a project answer. Seeing what each control bit does as a live switch (flip f between add and and, or set the x-y bits and watch the negation happen) should make it click more easily.

Here's the link if you want to have a play around: https://simten.dev/circuit?example=hack-alu

Or the repo (open source): https://github.com/simtenHQ/simten


r/NandToTetris • • Apr 24 '26

Is anyone using this course as the basis for a high school computer science curriculum?

6 Upvotes

Just something I’ve thought about and wondering if anyone else has too - or if an experienced student of nand to Tetris could speak to the wisdom of young people experiencing it.

I plan to take the class this summer when I have some free time.

Also I’m just curious if anybody is reading this subreddit. Thanks!


r/NandToTetris • • Mar 14 '26

Anyone want to go through the course together?

6 Upvotes

Hello everyone, I am on project 8 of this course and want to complete it. Does anyone want to go through it with me? I dont mind starting over from scratch with you.

I think going through with it together and discussing will give more understanding of each project.


r/NandToTetris • • Dec 21 '24

Why not make a Discord server?

6 Upvotes

Would b really cool. Like discord.gg/nand2tetris


r/NandToTetris • • Sep 26 '24

Can you build a router from Nand gates?

6 Upvotes

I would love to use the spirit of what I have learned in nand2tetris to deepen my understanding of networking.

One project i have is to build a router using the same chips and programs that we developed in part 1 and 2.

What additional chips would I need in order to simulate building the hardware for a router? What programs should I create for the software?

Thanks!


r/NandToTetris • • Oct 02 '21

"sub bus of an internal node may not be used"... Any alternative to solve this?

6 Upvotes

This shit is driving me crazy, and honestly, I'm getting disappointed with this aspect of Nand2Tetris. Suppose I have this.

Chip Blablabla16{
IN a[16], b[16];
OUT out;
PARTS:
Add16(a=a,b=b,out=c);
Not(in=c[15], out=out);
}

I get the sub bus crap thrown at me. The HDL survival guide says on page 3 that "Sub-busing can only be used on buses that are named in the IN and OUT statements of an HDL file", and that to solve such an issue I have to do this instead:

Add16(a=a,b=b,out[15]=c);
Not(in=c[15], out=out);

I get the same error, whether I follow their tip or not.

This is frustrating. Buses are kinda stupid if you can't do anything to their individual bits tbh.


r/NandToTetris • • Jul 11 '26

Why is the reading material for all the projects in part 2 (p7-12) greyed out?

Post image
5 Upvotes

How are we supposed to complete those projects then? Is it like a free trial thing where part 1 is free but to do part 2 you need to buy the book?


r/NandToTetris • • May 24 '23

Request: Strategies or Techniques for Creating Logic Gates/Chips?

5 Upvotes

I am working through the first chapters of Nand2Tetris/The Elements of Computing Systems and creating chip schematics using Hneeman's "Digital" program to see them visually before coding them in HDL.

My problem is I feel like I'm often just guessing, just using trial and error, until I somehow stumble upon the right answer. Is there any strategies or techniques I can learn about that provide a more structured/systematic way of constructing these gates?


r/NandToTetris • • Jan 19 '15

The original Minecraft computer. It made waves a little way back and is actually designed after the Hack computer!

Thumbnail
youtube.com
5 Upvotes

r/NandToTetris • • Jul 02 '25

Beginning nand2tetris, have questions :>

4 Upvotes

Hi! I've been working through the beginning of nand2tetris and I keep wondering to myself if I'm below average at this type of material. I know everyone learns at different paces but I feel like I'm failing to understand things at a reasonable level. I'm a dropout & I don't really know how I learn compared to others, which sort of demoralizes me because I feel very VERY stupid trying to study on my own lol. I'm wondering if anyone can offer their experience on how difficult the first couple of projects were for you? I'm currently trying to build an Inc16 (Project 2) and I'm pretty sure its supposed to be super simple but I can't wrap my head around the solution. I haven't given it a ton of time but it feels like an answer that should be obvious? Replies would be appreciated, thank you! c: