Skip to content

Latest commit

 

History

History
131 lines (91 loc) · 4.37 KB

File metadata and controls

131 lines (91 loc) · 4.37 KB

Programming Language Concepts

Code Structure

Each chapter refers to what files and directories are used for the topic. All code resides in directory plcFSharp.

For instance, the chapter on micro-SML refers to the subdirectories MicroVM and MicroSML found in plcFSharp. This means that all exampels and exercises can be completed by having those two directories available in a folder, e.g.,

.../ExerciseMicroSML/MicroVM
                    /MicroSML

You can also make code changes directly in the cloned repository. We recommend you copy the needed folders such that you do not need to implement all exercises in the same set of files.

Example Code

The table below should what directories contain example code used in each chapter.

Chapter Title Example Code
1 Introduction Intro
2 Interpreters and Compilers Intcomp
3 From Concrete Syntax to Abstract Syntax Usql, SExpr, Expr
4 A First-Order Functional Language Fun, TypedFun
5 Higher-Order Functions Fun
6 Polymorphic Types Fun
7 Imperative Languages Imp, MicroC
8 Compiling Micro-C MicroC
9 Real-World Abstract Machines Virtual
10 Garbage Collection ListC, MicroVM
11 Continuations Cont
12 A Locally Optimizing Compiler MicroC
13 Compiling Micro-SML MicroSML, MicroVM
14 Typing Micro-Java MicroJ
15 Compiling Micro-Java MicroJ, MicroVM
16 Real Machine Code: Arm64 Arm64
App. A Crash Course in F# Intro

Platform Dependencies

The supporting files work on Linux, MacOS and Windows platforms.

You need the following installed:

Installing Clang, Linux

One approach is to install using a package manager:

  • Debian: sudo apt install clang

The provided code has also been tested with default gcc compiler on various Linux distributions.

Installing Clang, MacOS

Clang is the default compiler on MacOS. No need for further installation. You can also compile with gcc which is likely an alias for clang.

Installing Clang, Windows x86_64

There are two dependencies that must be installed:

  1. MSVC toolchain

Find Build Tools for Visual Studio 2026, download the installer, and use it to select and install this workload:

  • Desktop development with C++
  1. clang for Windows x86_64, llvm
  • LLVM-22.1.0-win64.exe (or later)

Consult MicroVM/README.md to test the installation on the micro virtual machine, microvm.c.

You may check version and any later version should work:

  $ clang --version
clang version 22.1.0 (https://github.com/llvm/llvm-project 4434dabb69916856b824f68a64b029c67175e532)
Target: x86_64-pc-windows-msvc

Installing Clang, Windows Arm64 (WOA)

Install MSYS2, which is a Unix-style environment for building native Windows programs. Then you can build the provided C code and Arm64 assembly examples exactly as described for Linux in other READMEs.

Go to https://www.msys2.org/, download the installer called something like msys2-arm64-yyyymmdd.exe and run it. This will install MSYS2 in directory C:\msys64.

Run C:\msys64\clangarm64.exe which opens a Linux-style command line prompt.

Update the msys2 package list using the pacman package manager in msys2:

  $ pacman -Suy

Install clang tools and so on:

  $ pacman -S mingw-w64-clang-aarch64-clang

Consult MicroVM/README.md to test the installation on the micro virtual machine, microvm.c.