Giter Site home page Giter Site logo

egg-language-extended's Introduction

egg-language-extended

Extension of EloquentJS programming language.

EGG Language

Tokens

WHITES            = /\s/y;
COMMENTS          = /#.*(\n|\r)?/y;
LEFT_PARENTHESIS  = /[(]/y;
RIGHT_PARENTHESIS = /[)]/y;
COMMA             = /,/y;
STRING            = /"([^"]*)"/y;
NUMBER            = /\d+\b/y;
WORD              = /[^\s(),#"]+/y;

Syntax

expression: ( STRING 
          | NUMBER 
          | WORD ) apply 

apply: /* vacio */
     | '(' (expression ',')* expression? ')' apply

How to use

install npm packages

First install npm packages:

$ npm install

Running tests

You can run all tests available with following command:

$ npm test

Executables

Then you can use bin/*.js executables to run examples/*.egg files, or any other file you create with EGG syntax.

Also you can use -h for help in any of these executables.

Running Egg-REPL

If you run bin/egg.js without any parameters, a REPL interface will launch up with the same capabilities as egg.js parser and interpreter.

$ node bin/egg.js
> Version 0.5.0
> help()
help() muestra esta ayuda.
exit() sale del bucle REPL.
Ctrl-D sale del bucle REPL.
'-------------------------'
> 

Running an EGG program

$ node bin/egg.js examples/one.egg

50

Parsing an EGG program

$ node bin/eggc.js examples/one.egg

Output in file 'examples/one.egg.evm'

examples/one.egg.evm:

{
  "type": "apply",
  "operator": {
    "type": "word",
    "name": "do"
  },
  "args": [
    {
      "type": "apply",
      "operator": {
        "type": "word",
        "name": "define"
      },
      "args": [
        {
          "type": "word",
          "name": "x"
        },
        {
          "type": "value",
          "value": 4
        }
      ]
    },
    . . .

Running an EGG program via AST (json)

$ node bin/evm.js examples/one.egg.evm

50

egg-language-extended's People

Contributors

alu0100969535 avatar crguezl avatar faaa97 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.