Skip to content
프로젝트

keleshev/compiling-to-assembly-from-scratch

GitHub에서 보기

소개

Source code for the book Compiling to Assembly from Scratch https://keleshev.com/cas

학습 및 교육

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Compiling to Assembly from Scratch

This repository contains source code from the book Compiling to Assembly from Scratch, plus ports to other langauges (currently Python, OCaml, and Rust)

Structure

  • part-1 folder contains the baseline compiler from Part I of the book.
  • part-2 folder contains the extended compiler from Part II of the book.
  • contrib folder is for various other versions of the compiler. Contributions are welcome.

Running the code

The book's compilers are wirtten in TypeScript, so you need to install the TypeScript compiler. TypeScript compiles to JavaScript, so you need Node to run it in a non-browser environment (however, it works in browser too).

On Rasperry Pi

Install Node and TypeScript:

$ sudo apt-get install npm
$ sudo npm install -g typescript

Now you've got everything necessary to run the compiler's test suite. No emulation or cross-assembling necessary.

$ make CC=gcc RUN=''

On x86-64 Linux

This assumes apt-get package manager.

Install TypeScript (and Node, as a dependency):

$ sudo apt-get install npm
$ sudo npm install -g typescript

Install GCC toolchain that targets 32-bit ARM:

$ sudo apt-get install gcc-arm-linux-gnueabihf

Install QEMU emulator:

$ sudo apt-get install qemu-user-static

Run baseline compiler's test suite:

$ make CC='arm-linux-gnueabihf-gcc -static' RUN='qemu-arm-static'

In the browser

Minimal browser playground is available as well.

cd part-2
make ../docs/build.js
open ../docs/index.html

Contribution

You are welcome to contribute your version of the book's compiler. Make a pull request into the contrib directory.

관련 프로젝트 살펴보기

불러오는 중…