Get the latest tech news

Writing Micro Compiler in OCaml (2014)


TL;DR Writing micro compiler in OCaml At one point or another every single software developer in the world comes to a realization in his career when …

Unfortunately OCaml doesn’t have an unread operation like libc’s ungetc so we’ll need to define a simple stream reader which will have a mutable char and we will also count lines of source code read. We’ll define some additional utility functions which will be used during parsing including an Syntax_error exception which will be thrown if invalid token is scanned. Our parsing method will be combined with semantics checking and will output asm code using generator functions which we will define later.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of ocaml

ocaml

Related news:

News photo

Basic dependency injection in OCaml with objects

News photo

OCaml as my primary language

News photo

Writing a Game Boy Emulator in OCaml (2022)