Skip to content

Recent Posts

  • The Hidden Risks of Shadow IT in UK Businesses
  • 7 Best Roblox Executors in 2026 That Still Work After the Latest Roblox Updates
  • How To Rent a Dedicated Server?
  • Hoosha and the Rise of Farsi AI: Transforming Persian Digital Experiences Through Localized Intelligence
  • Products and services Given by a Look for Motor Optimization Enterprise

Most Used Categories

  • Tech News (512)
  • SEO (503)
  • Hosting (492)
  • Programmer (486)
  • Telecom (482)
  • Provider (271)
  • SocMed (213)
  • Business (27)
  • Technology (22)
  • Design & Development (11)
Skip to content
block blink

block blink

Experienced in technology

  • Tech News
  • SEO
  • Telecom
  • Programmer
  • Hosting
  • Provider
  • About Us
    • Advertise Here
    • Contact Us
    • Privacy Policy
    • Sitemap
  • Home
  • Create A Compiler Step-By-Step | Hackaday
Create A Compiler Step-By-Step | Hackaday

Create A Compiler Step-By-Step | Hackaday

Bunga CitraNovember 28, 2022

While JavaScript might not be the ideal language to write a production compiler, you might enjoy the “Create Your Own Compiler” tutorial that does an annotated walkthrough of “The Super Tiny Compiler” and teaches you the basics of writing a compiler from scratch.

The super tiny compiler itself is about 200 lines of code. The source code is well, over 1,000 but that’s because of the literate programming comments. The fancy title comments are about half as large as the actual compiler.

The compiler’s goal is to take Lisp-style functions and convert them to equivalent C-style function calls. For example: (add 5 (subtract 3 1) would become add(5,subtract(3,1)).

Of course, there are several shortcut methods you could use to do this pretty easily, but the compiler uses a structure like most full-blown modern compilers. There is a parser, an abstract representation phase, and code generation.

Even if you don’t like the slide-show approach, the literate commented JavaScript is easy to read and very instructive. If you don’t know JavaScript it should still be fairly easy to work it out if you know any common programming language.

At the bottom left of the page are two buttons: Verbose and Internals. You can press these at any time. Text due to the verbose button will have a blue line next to it and text about internals will have a red line. This allows you to tune the experience depending on how much detail you’d like to read.

This isn’t the first compiler we’ve seen chopped up for exposition. If you are interested in what existing compilers generate for source input, we were always impressed with Compiler Explorer.

Compiler, Create, Hackaday, stepbystep

Post navigation

Previous: 40 Best Walmart Cyber Monday Deals (2022): TVs, Vacuums, Earbuds, Sonos
Next: Here’s A Plain C/C++ Implementation Of AI Speech Recognition, So Get Hackin’

Related Posts

How To Rent a Dedicated Server?

How To Rent a Dedicated Server?

September 29, 2025September 29, 2025 Bunga Citra
Shockingly Excellent Assistance From a Web hosting Corporation – Worthy of Shouting About

Shockingly Excellent Assistance From a Web hosting Corporation – Worthy of Shouting About

December 21, 2024March 24, 2023 Bunga Citra
Recommendations to Pick the Most effective Website Web hosting Corporation For Your E-Company

Recommendations to Pick the Most effective Website Web hosting Corporation For Your E-Company

December 16, 2024March 24, 2023 Bunga Citra

Recent Posts

  • The Hidden Risks of Shadow IT in UK Businesses
  • 7 Best Roblox Executors in 2026 That Still Work After the Latest Roblox Updates
  • How To Rent a Dedicated Server?
  • Hoosha and the Rise of Farsi AI: Transforming Persian Digital Experiences Through Localized Intelligence
  • Products and services Given by a Look for Motor Optimization Enterprise

Categories

  • Beauty
  • Business
  • Dental
  • Design & Development
  • Digital Marketing
  • Forex
  • Games
  • Health
  • Home Improvement
  • Hosting
  • Jewelry
  • Law and Legal
  • PC Game
  • Programmer
  • Provider
  • Real Estate
  • SEO
  • Small Business Tips
  • SocMed
  • Tech News
  • Technology
  • Telecom
  • Travel

Archives

BL

Home sweet home, always
Copyright @ blockblink.com | Theme: BlockWP by Candid Themes.