Giter Club home page Giter Club logo

magc's Introduction

mag banner

Introduction

magc is a compiler library which translates Mag code into a series of executable instructions for the Strontium machine.

More specifically, the Compiler struct found in this library combines the Lexer and Parser modules along with its own code generation code into a pipeline. This processing pipeline then produces a sequence of bytecode instructions representing the semantics of the Mag source string and finally executes it on an instance of the strontium VM.

Please refer to the mag-lang crate to find code examples for the Mag language.

How far along are we?

The current implementation has a fairly complete implementation of the lexer and parser stages of the compiler, so building an AST from a source string works quite well. The code generation modules are very new though, so the function set available in the REPL is limited for now. Simple arithmetic operators with two operators work already, such as +, -, * and /. More is in the works. Don't nest infix expressions for now. There are still many rough edges to this project.

Credits

Mag is based on the Magpie language by Robert Nystrom, who is a language engineer at Google with a blog and a lot of amazing ideas. His various blog posts are what started and inspired this project, and I plan on continuing his legacy even if the original codebase ceases further development.

However, since there are a few syntactical differences to the original Magpie language, the two languages are source-incompatible and thus have different names. In particular, Bob's implementation substitutes the dot commonly used for calling methods on objects with a space (usually a meaningless character), which I find rather unintuitive, especially for new programmers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.