Giter Club home page Giter Club logo

beast-dragon's Introduction

Beast Programming Language

Build Status

Beast is a new programming language mostly inspired by C++ and D.

This repository contains (everything is WIP):

Source file extension: .be

Notable language features

  • Importable modules (no header files like in C++)
  • C++ style multiple inheritance class system
  • Powerful compile-time engine
  • Compiled (to C so far, switch to LLVM is planned)
  • Const-by-default
  • Compile-time language reflection

Progress

!!! DEVELOPMENT CANCELLED

  • Compiler: The compiler now works as a proof-of-concept. It has some core functionality working, but not really anything you could write your programs with.
    • See test/tests for working code examples
  • Std library: Nothing at all
  • Language reference: Nothing much

Contact

Author: Daniel 'Danol' Čejchan
Email: [email protected]

Sample code

Please note that this code describes what the language should be able to do when done, not what it can do now.

For currently compilable code, ses tests in test/tests. Compiling and running the testsuite (./runTests) generates commands required for running each test (commands are in log files in the test/log directory).

Specifically, tests in the examples folder are designed as examples.

class C {

@public:
  Int! x; // Int! == mutable Int

@public:
  Int #opBinary( Operator.binPlus, Int other ) { // Operator overloading, constant-value parameters
    return x + other;
  }

}

enum Enum {
  a, b, c;

  // Enum member functions
  Enum invertedValue() {
    return c - this;
  }
}

String foo( Enum e, @ctime Type T ) { // T is a 'template' parameter
  // 'template' and normal parameters are in the same parentheses
  return e.to( String ) + T.#identifier; 
}

Void main() {
  // @ctime variables are evaluated at compile time
  @ctime Type T! = Int; // Type variables!
  T x = 3;

  T = C;
  T!? c := new auto(); // C!? - reference to a mutable object, := reference assignment operator
  c.x = 5;

  // Compile-time function execution, :XXX accessor that looks in parameter type
  @ctime String s = foo( :a, Int );
  stdout.writeln( s );

  stdout.writeln( c + x ); // Writes 8
  stdout.writeln( c.#opBinary.#parameters[1].type.#identifier ); // Compile-time reflection
}

How to build

  1. Download a D compiler
  2. Clone this repository
  3. Execute dub build in the root
  4. Folder bin is created with the Beast Dragon compiler

News

29.10.2018: Development cancelled. I was planning to continue working on Beast as my master thesis, but they rejected it. Bummer. Feel free to use anything, but I don't expect it to be of any use in the current state.

05.05.2017: Finished writing code for bachelor's thesis. Development of this project is now halted until master thesis or until excessive interest for this project is shown from a community.

27.04.2017: Static functions with @ctime parameters implemented! They generate kinda messy code ("template" instances are not joined when provided with same arguments), but still, we have them!

21.04.2017: We now should have fully working @ctime mirroring in both interpreter and cpp backends.

14.04.2017: @ctime variables now work in runtime functions and are properly mirrored! (the subsystem has to be implemented for interpreter yet). See test/ctime/t_basicmirroring.

04.04.2017: We have classes now! Constructors are not generated automatically, so you have to do Void #ctor() { mem1.#ctor(); mem2.#ctor(); }

beast-dragon's People

Contributors

caddydz avatar czdanol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

beast-dragon's Issues

Build fails on linux (F25)

/usr/include/features.h:148:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~~~~~
cc1plus: all warnings being treated as errors

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.