Giter VIP home page Giter VIP logo

react-lang's Introduction

react-lang

A React renderer to real programs!

DO YOU CONSIDER YOURSELF A MASTER PROGRAMMER? BUT ARE YOU DISCOURAGED BY THE FACT THAT YOU ONLY KNOW BASIC HTML? WELL THAN I HAVE THE PROJECT FOR YOU! NOW, WITH THE SIMPLE, CONCISE, AND FAMILIAR SYNTAX OF JSX, YOU CAN EASILY PROGRAM JAVASCRIPT CONSTRUCTS LIKE:

  • LOOPS
    <for init={
        <variableDeclaration>
            <variableDeclarator>
                <identifier>i</identifier>
                {0}
            </variableDeclarator>
        </variableDeclaration>
    }
    
    test={
        <binary operator="<=">
            <identifier>i</identifier>
            {10}
        </binary>
    }
    
    update={
        <update operator="++" prefix={false}>
            <identifier>i</identifier>
        </update>
    }>
        <expressionStatement>
            <call>
                <identifier>sayHello</identifier>
            </call>
        </expressionStatement>
    </for>

    COMPILES DOWN TO

    for (let i = 0; i <= 10; i++) sayHello();
  • CLASSES
    <classDeclaration id={<identifier>Greeter</identifier>} superClass={<identifier>AbstractGreeter</identifier>}>
        <decorator>
            <identifier>
                greetable
            </identifier>
        </decorator>
        <classBody>
            <classMethod id={<identifier>constructor</identifier>} generator={true} kind="constructor" params={
                [
                    <arrayPattern>
                        <identifier>hello</identifier>
                        <identifier>world</identifier>
                        <identifier>object</identifier>
                    </arrayPattern>
                ]
            }>
                <decorator>
                    <identifier>
                        greetable
                    </identifier>
                </decorator>
                <identifier>constructor</identifier>
                <block>
                    <debugger />
                </block>
            </classMethod>
            <classMethod id={<identifier>helloWorld</identifier>} computed={true} static={true} async={true} kind="get" params={
                [
                    <arrayPattern>
                        <identifier>hello</identifier>
                        <identifier>world</identifier>
                        <identifier>object</identifier>
                    </arrayPattern>
                ]
            }>
                <decorator>
                    <identifier>
                        greetable
                    </identifier>
                </decorator>
                <identifier>helloWorld</identifier>
                <block>
                    <debugger />
                </block>
            </classMethod>
            <classProperty static={true} computed={true}>
                <identifier>hello</identifier>
                <identifier>world</identifier>
            </classProperty>
        </classBody>
    </classDeclaration>

    COMPILES DOWN TO

    @greetable
    class Greeter extends AbstractGreeter {
      @greetable
      *constructor([hello, world, object]) {
        debugger;
      }
    
      @greetable
      static get async [helloWorld]([hello, world, object]) {
        debugger;
      }
    
      static [hello] = world;
    }
  • FUNCTIONS
    <arrowFunction async={true} params={
        [
            <arrayPattern>
                <identifier>hello</identifier>
                <identifier>world</identifier>
                <identifier>object</identifier>
            </arrayPattern>
        ]
    }>
        <block>
            <debugger />
        </block>
    </arrowFunction>

    COMPILES DOWN TO

    async ([hello, world, object]) => {
      debugger;
    }
  • OBJECTS
    <objectExpression>
        <objectProperty shorthand={true}>
            <identifier>hello</identifier>
        </objectProperty>
        <objectProperty computed={true}>
            <decorator>
                <identifier>
                    greetable
                </identifier>
            </decorator>
            <identifier>hello</identifier>
            <identifier>world</identifier>
        </objectProperty>
        <objectMethod computed={true} id={<identifier>helloWorld</identifier>} generator={true} async={true} kind="set" params={
            [
                <arrayPattern>
                    <identifier>hello</identifier>
                    <identifier>world</identifier>
                    <identifier>object</identifier>
                </arrayPattern>
            ]
        }>
            <decorator>
                <identifier>
                    greetable
                </identifier>
            </decorator>
            <identifier>hello</identifier>
            <block>
                <debugger />
            </block>
        </objectMethod>
        <spread>
            <identifier>toExtend</identifier>
        </spread>
    </objectExpression>

    COMPILES DOWN TO

    {
      hello,
      @greetable
      [hello]: world,
    
      @greetable
      set async [hello]([hello, world, object]) {
        debugger;
      },
    
      ...toExtend
    }

AND MORE!

Stuff in the src folder is being actively worked on. You can see my progress here.

Mr. Rosier: Yes, this is Eli Bradley's project. Please click on the username.

All contributions are welcome, as long as you want to license your contributions under the same Apache 2.0 license!

react-lang's People

Contributors

ethertyper avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  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.