Giter Site home page Giter Site logo

charlesaverill / purple Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 23.79 MB

Purple standard language specification and compiler implementation

Home Page: http://charles.systems/Purple/

License: GNU General Public License v3.0

CMake 0.51% Shell 2.27% C 95.50% GAP 1.72%
c compiler programming-language programming-language-development

purple's Introduction

Purple Language Documentation

The standard language specification and compiler for Purple, a general-purpose, C-like language intended to introduce higher-level functionality and lower-level memory access.

Original Implementation

Installation

View the source here.

Dependencies

  • clang-{10+}
  • libclang-{10+}-dev

Purple may be built with cmake:

cmake -B build
cmake --build build

bin/purple example_file.prp

Grammar

BNF-formatted grammar for Purple can be found here: Purple Grammar Documentation

Examples

Purple uses C-style syntax, although this may change as the compiler is built

void main(void) {
    int bob;
    int alice;

    bob = 5;
    alice = 10;

    print bob + alice; // 15
    print bob > alice; // 0

    int bob_alice;
    bob_alice = 10 + 10 + bob + alice; // 35
    if(bob_alice > 30){
        print bob_alice;
    }

    int i;
    i = 0;
    while (i < 20) {
        print i;
        i = i + 1;
    } else {
        print i == 0 or true; // true
    }
}

More examples can be viewed here.

purple's People

Contributors

charlesaverill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

reyandotco

purple's Issues

Target triple backup

If clang -print-target-triple fails, read the target triple from the generated tmpfile

Add position info to ASTNode

ASTNodes should have filename, line_number, and character_number attributes so that compile errors found in the code generation phase print out the correct position information instead of EOF

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.