{"id":15060310,"url":"https://github.com/cyber-anubis/the-hack-general-purpose-computer","last_synced_at":"2026-01-25T15:02:53.585Z","repository":{"id":51678712,"uuid":"247869956","full_name":"cyber-anubis/The-HACK-General-Purpose-Computer","owner":"cyber-anubis","description":"Using HDL, from Boolean algebra and elementary logic gates to building a Central Processing Unit, a memory system, and a hardware platform, leading up to a 16-bit general-purpose computer. Then, implementing the modern software hierarchy designed to enable the translation and execution of object-based, high-level languages on a bare-bone computer hardware platform; Including Virtual machine,Compiler and Operating system.","archived":false,"fork":false,"pushed_at":"2020-10-02T14:15:21.000Z","size":155,"stargazers_count":99,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-14T22:12:05.017Z","etag":null,"topics":["arithmetic-logic-unit","assembler","compiler","computer-architecture","cpu","hardware-description-language","machine-language","nand","nand2tetris","operating-system","virtual-machine"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyber-anubis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-17T03:23:27.000Z","updated_at":"2024-11-22T14:53:36.000Z","dependencies_parsed_at":"2022-08-03T09:30:16.000Z","dependency_job_id":null,"html_url":"https://github.com/cyber-anubis/The-HACK-General-Purpose-Computer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyber-anubis%2FThe-HACK-General-Purpose-Computer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyber-anubis%2FThe-HACK-General-Purpose-Computer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyber-anubis%2FThe-HACK-General-Purpose-Computer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyber-anubis%2FThe-HACK-General-Purpose-Computer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyber-anubis","download_url":"https://codeload.github.com/cyber-anubis/The-HACK-General-Purpose-Computer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235711,"owners_count":22036965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arithmetic-logic-unit","assembler","compiler","computer-architecture","cpu","hardware-description-language","machine-language","nand","nand2tetris","operating-system","virtual-machine"],"created_at":"2024-09-24T22:56:41.567Z","updated_at":"2026-01-25T15:02:53.512Z","avatar_url":"https://github.com/cyber-anubis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The-HACK-General-Purpose-Computer\n\n\u003e **What I hear, I forget; What I see, I remember; What I do, I understand.\n—Confucius, 551–479 BC**\n\nThe Nand to Tetris project is about going into fascinating voyage of discovery in which I go all the way from Boolean algebra and elementary logic gates to building a \u003cins\u003e**Central Processing Unit**\u003c/ins\u003e, a memory system, and a hardware platform, leading up to a \u003cins\u003e****general-purpose computer****\u003c/ins\u003e that can run any program that you fancy.\nThis is typically the hardware part of the overall project which relies on many sub-projects waiting to be assembled togther. \n\nThere is no need for physical materials, since I build the computer on my own PC, using a software-based hardware simulator, just like real computers are designed by computer engineers in the field.\n\nIn the second part of the overall project: we build a modern \u003cins\u003e**software hierarchy**\u003c/ins\u003e, designed to enable the translation and execution of object-based, high-level languages on a bare-bone computer hardware platform.\n\nIn particular, I will implement a \u003cins\u003e**virtual machine**\u003c/ins\u003e and a \u003cins\u003e**compiler**\u003c/ins\u003e for a simple, Java-like programming language, and I will develop a basic \u003cins\u003e**operating system**\u003c/ins\u003e that closes gaps between the high-level language and the underlying hardware platform.\n\nDuring the process, gaining a deep, hands-on understanding of numerous topics in applied computer science, \u003cins\u003ee.g. stack processing, parsing, code generation, and classical algorithms and data structures for memory management, vector graphics, input-output handling\u003c/ins\u003e, and various other topics that lie at the very core of every modern computer system.\n\n## What is going on here in a nutshell?\n\n![overview](https://user-images.githubusercontent.com/33065305/77091388-25d62180-6a11-11ea-841e-331e6df59f40.png)\n* **Hardware:** Logic gates, Boolean arithmetic, multiplexors, flip-flops, registers,\nRAM units, counters, Hardware Description Language (HDL), chip simulation and\ntesting.\n* **Architecture:** ALU/CPU design and implementation, machine code, assembly\nlanguage programming, addressing modes, memory-mapped input/output (I/O).\n* **Operating systems:** Memory management, math library, basic I/O drivers,\nscreen management, file I/O, high-level language support.\n* **Programming languages:** Object-based design and programming, abstract data\ntypes, scoping rules, syntax and semantics, references.\n* **Compilers:** Lexical analysis, top-down parsing, symbol tables, virtual stackbased\nmachine, code generation, implementation of arrays and objects.\n* **Data structures and algorithms:** Stacks, hash tables, lists, recursion, arithmetic\nalgorithms, geometric algorithms, running time considerations.\n* **Software engineering:** Modular design, the interface/implementation paradigm,\nAPI design and documentation, proactive test planning, programming at the large,\nquality assurance.\n\n\n## Todo list:\nSub-projects in real-time progress.\n### Computer Hardware \u0026 Architecture\n* 1-**Elementary Logic Gates:**:heavy_check_mark: Building elementary logic gates like And, Or, Not, Multiplexor, and more \n* 2-**Adders Family \u0026 ALU:**:heavy_check_mark: Building a family of adder chips, culminating in the construction of an Arithmetic Logic Unit (ALU)  \n* 3-**Memory Units:**:heavy_check_mark: Building registers and memory units, culminating in the construction of a Random Access Memory (RAM)  \n* 4-**HACK Machine Language:**:heavy_check_mark: Learning a machine language and using it to write some illustrative low-level programs \n* 5-**Computer Architecture \u0026 CPU:**:heavy_check_mark: Using the chipset built in projects 1-3 to build a Central Processing Unit (CPU) and a hardware platform capable of executing programs written in the machine language introduced in project 4.\n### Computer Software Hierarchy\n* 6-**HACK Assembler:**:heavy_check_mark: Developing an assembler, i.e. a capability to translate programs written in symbolic machine language into binary, executable code.\n* 7-**Virtual Machine I: (Stack Arithmetic)**:heavy_check_mark: Building a stack-based virtual machine. This implementation, in turn, will serve as the backend module of the two-tier compiler that will be developed later. In this first part, stack-based arithmetic operations \u0026 memory access operations will be handled.\n* 8-**Virtual Machine II: (Program Control)**:heavy_check_mark:  In this project I'll complete the VM translator by implementing the remaining VM language's branching and function-calling commands. Implementing concepts like: program flow (if statments), loops (while), function calling (stack frame saving \u0026 retrieving) ...etc.\n* 9-**High-Level Language:**:heavy_check_mark: Designing and creating the JACK high level programming language; object-based Java-like language. Implemented concepts: procedural programming, object-based programming, classes, methods, functions, constructors, list processing, recursion, developing interactive applications (**Hell Arena Game**), graphics optimization.\n* 10-**Compiler I: (Syntax Analysis)**:heavy_check_mark: Creating the two-tier complier for the JACK high level language. Syntax analysis consists of two sub-stages: lexical analysis (also called tokenizing), and parsing. The result will be a Jack analyzer - a program that unveils the syntax of Jack programs without generating executable code. Key concepts: tokenizing, grammars, parsing, parse trees, XML / mark-up, compilation.\n* 11-**Compiler II: (Code Generation)**:hourglass_flowing_sand: Finalizing the compiler for the JACK high level language. I'll morph the previous analyzer into a full-scale Jack compiler. Generating VM code that translates procedural programs into VM programs, and how to generate VM code for constructing and manipulating arrays and objects. Key concepts: compiling procedural code, compiling the construction and manipulation of arrays and objects, code generation techniques, recursive compilation engine, symbol tables, memory management.\n* 12-**More fun to go?:** Implementing full but simple Operating system for the HACK computer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyber-anubis%2Fthe-hack-general-purpose-computer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyber-anubis%2Fthe-hack-general-purpose-computer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyber-anubis%2Fthe-hack-general-purpose-computer/lists"}