Motivation

The goal of this project is to transform a functional language that accepts programmer defined features (also known as macros), to x86 assembly and C.

Our Language, M0

Features of M0

The language M0 supports many common programming features such as the ability to define and apply functions, while loop, branching (e.g. if-else statements), etc.

More importantly, M0 allows programmers to define their own programming features, i.e. macros.

Macros

The ability to define programming features ourselves becomes relevant when we want to quickly extend a programming language instead of waiting for the next standard of the language to finalize and be implemented in the compiler/interpreter we use. In my opinion, compiler technologies such as babel has helped Javascript to advance faster than without it!

Example of Making a Programming Defined Feature in M0

Say we want to make the (math) summation feature in our language:

That is, a programming feature that takes in

  1. a name that represents the value in each iteration of the summation
  2. start and end value for the summation
  3. an operation, whose value is to be summed for the summation

e.g.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ad01c102-0009-45b2-98e7-4715a5633d8f/ScreenShot2018-11-29at4.48.48PM.png

  1. i is the name
  2. start is 1, end is 4
  3. operation to be summed is the value of i + 1