Giter VIP home page Giter VIP logo

cupcake-compiler's Introduction

Cupcake

Cupcake

Cupcake is a compiler for Jonathan Blows new programming language JAI. The compiler is built from the ideas and temporary specification that Blow has given in his Youtube and Twitch videos. Cupcake has almost everything implemented that Jonathan Blow has shown in his videos so far (2016-06-12).

Both Cupcake and me has no association with Jonathan Blow or JAIs development. The experience you have with Cupcake should not be reflected towards JAI and your opinion of it, Cupcake is not JAI. Cupcake is my hobby project, created for me to learn how a compiler works and how programs goes from source code to machine code.

Platform support

Status
Windows 32bit v0.1-alpha

More platforms will be supported later. There is a lot of windows specific code in this release and it will take a while to port everything over.

Download

Here is the latest release: Cupcake v0.1-alpha.

Version Date Link
v0.1-alpha 2016-06-12 Download

Usage

  1. Download the latest release.
  2. Unpack in a seperate folder.
  3. Run the compiler through the console.
cupcake main.jai
Usage: cupcake <source>... [options]
Options:
  -v --version           Show version
  -h --help              Show this screen
     --nologo            Disable Cupcake logo
  -r --run <code>        Executes the code
  -l --modules <path>    Include modules from folder [include already: ./modules/]
  -m --module <file>     Include module

Cupcake, as JAI, does not generate machine code (yet). There are two ways to execute your code, run the code in the compiler itself through bytecode (#run) or compile/convert your JAI code to C++ code. Currently a C++ file will always be generated and there is no way to turn it off. The output location for the C++ file is %EXECUTABLE_PATH%/output/output.cpp, the location can be changed by using the compiler workspace feature.

Documentation

The release includes a few examples, but there is no other documentation available to Cupcake. The game example is the invaders game Jonathan Blow showed in the first few demos. To test the examples just type this in to the console.

cupcake examples/EXAMPLE_NAME/main.jai

Because the specification for JAI is not complete, writing a documentation is stupid. Though some nice people have written stuff about the language that could be used as documentation.

Jai Primer by Jorge Rodríguez.

Jai Programming Language – Resources and Information by Inductive.

After using Cupcake, if you have any nice code examples, please send them to [email protected] and I added them to the examples folder.

Features

The progress of JAI features that Cupcake has:

Video Implemented Status Tested Status
Base language, compile-time execution Everything implemented Good enough
Iteration and arrays, uninitialized values, enums Everything but inlining Good enough
SOA, composition Everything implemented Good enough
Run-Time (and Compile-Time) Type Information Everything but check calls and embedded systems Good enough
Arguments and Return Values Everything but double multi-return and #must Good enough
Polymorphic Procedures Part 1 & Part 2 Everything implemented Good enough
Implicit Context Everything implemented Good enough
Bounds check, here strings, overloading Everything implemented Good enough
Self-browsing code, compiler message loop, workspaces Everything but self-browsing code Good enough
Code Modification Can not be implemented without self-browsing code Not tested
Structs with Parameters Everything implemented Good enough
First-Class (-Ish?) Types Everything implemented Good enough
Iterators, (Overloading x Polymorphism) Everything implemented Good enough

Issues

The goal is to make Cupcake as great as possible and to do that i need your help. If you find any problems/bugs, please report them and don't forget to send example code that demonstrates the problem. You can use the Github issue section or send me an email at [email protected] (use the email if you don't want the demonstration source code to be public).

Source Code?

For now I have decided to not release the source code. Why, because I don't know if it would be fair to Jonathan Blow and I am not very proud of the quality of the code. There is a huge amount of unnecessary code that could and should be removed, Cupcake v0.1-alpha is around 45k LOC.

Licence

MIT License

Copyright (c) 2016 Jonathan Wase

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cupcake-compiler's People

Contributors

julgodis avatar

Watchers

James Cloos avatar

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.