Git Product home page Git Product logo

seal-language's Introduction

Seal The Program Language

What is seal

Seal is a program language based on C++, writing seal code is equivalent to writing C++ code, seal dose not prviode a compiler, instead of compiling, your seal code will be translated into C++ code and the C++ code will be compiled by C++ compiler, like this:

@from std

interface my_interface {
    fn method() -> var:void;
    fn default_method() -> var:int { return 4; }
}

class inherf_class <- interface my_interface {
    @public
    inherf_class() => value = 4;

    @public
    fn class_method() {
        foreach (i in 0 to (default_method())) {
            std.io.print(' ', i);
        }
        std.io.print('\n');
    }

    @override
    fn method() -> var:void {
        std.io.print(value, "\n");
        std.io.print("Hello Seal!\n");
    }

    @private
    var:int value;
}

fn main() -> var:int {
    var instance = inherf_class();
    instance.method();
    instance.class_method();

    return 0;
}

It will be translated into C++ code like this:

#include "std_.hpp"
class my_interface {
public: virtual void method() = 0;
public: virtual int default_method()
{
return 4;
}
};

class inherf_class : public my_interface 
{
public: inherf_class(){ value=4; }
public: auto class_method()
{
for (auto i = 0; i < (default_method()); ++i)
{
std_::io.print(' ',i);
}
std_::io.print('\n');
}
public: void method() override
{
std_::io.print(value,"\n");
std_::io.print("Hello Seal!\n");
}
private: int value;

};
int main()
{
auto instance = inherf_class();
instance.method();
instance.class_method();
instance.method();
return 0;
}

Then the C++ code will be compiled by C++ compiler like clang, then out the result.

Why Seal

Seal likes a wrapper to C++ language, or the higher level of a Marco? If you want a C++ code result and have a simpler(May not very simple) code experience, you can try Seal, seal may leave a good exprenicen when you writing a small project, and you can include your cpp code in seal as well, just like this:

@from std

fn main() {
    @cpp cbegin
        printf("Hello World!");
    cend;
    return 0;
}

Example

All of the seal language example are all collect in the example folder.

How to use

Download the release from the release page and run the command like this:

seal -m main.se -s

Notice

Seal is still in developing, so it will may exsits some bugs and imperfections, if you have any problem you can goto issuesPages; and issues.ask(yourProblem) :)

seal-language's People

Contributors

fsmargoo avatar

Watchers

 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.