Code Monkey home page Code Monkey logo

yamas's Introduction

Fujiyama1

Yamas

YAMAS stand for Yet Another Markup As Script

Why?

I use lots of YAML in different apps. They all have their own implicit logic behind data structure and documentation. Nowadays, YAML is being used as near-script language anyways. (Also it looks like Python.)

Design

  1. Super simple
  2. No native loops
  3. Limited native functions:
    • ECHO@
    • LINE@
    • HTTP@
    • BASH@
    • PARSE@

Variables and memory management

Use Rust's "ownership" concept.

  • A variable ownership can be passed around using @TAKE and @PUT.
  • Only @RUN can be the owner (should we change the name @RUN to @THREAD to make it more clear? ๐Ÿค”)
  • Once @RUN is run, values in variables are dropped and cleaned

Syntax

"Hello World"

THREAD@:
  - ECHO@: "Hello World \n"
  - LINE@: "Hello World"

If

RUN@:
  - SET@:
      - NAME@: hello
        VALUE@: "world"
  - SET@
      - NAME@: peace
      - VALUE@: true
  - IF@:
      AND@:
        - EQ@: 
          - ${hello}
          - "world"
        - EQ@:
          - ${peace}
          - true
      THEN@:
        - ECHO@: |
           Hello World! 

Go to

RUN@:
  - SET@:
      - NAME@: hello
        VALUE@: world
  - IF@:
      - EQ@: 
        - ${hello}
        - "world"
      THEN@:
        - GOTO@: 1
        - GOTO@: 2
        - GOTO@: 3
  - LOC_1@:
      - ECHO@: Hello
      - RETURN@
  - LOC_2@:
      - ECHO@: " World"
      - RETURN@
  - LOC_3@:
      - ECHO@: "\n"
      - RETURN@

Function Call

RUN@:
  - FN@: World
    TAKE@:
      - greeting
    RUN@:
      - IF@: ${greeting} == "world"
        THEN@:
          - RETURN: "World"
  - ECHO@:
      FROM@:
        - "Hello"
        - FROM_CALL@: World
          PUT@:
            - greeting: "Hello"

Statements & declarations

  • FROM@
RUN@:
  - ECHO@:
      FROM@:
        - "Hello"
        - " World"
        - "\n"

Native methods

  • PARSE@
PARSE@:
   KIND@: JSON
   FROM@: |
      { 
        "foo": "bar", 
        "soo": "taa", 
        "bip": {
          "bap": "boop"
        }
      }
   SET_FROM@:
      - bipbap: "bip.bap"
ECHO@: ${bipbap}

Expressions & operators

  • EQ@, NE@, GT@, L@, GTE@, LTE@
EQ@:
   - ${foo}
   - "bar"
 foo === "bar"
  • ADD@, SUB@, MUL@, DIV@
@SET_NUM:
   - "added"
   - @FROM:
      - @ADD
         - ${added}
         - 1
 added = added + 1;

Some random reading

Footnotes

  1. Photo by Jules Marvin Eguilos on Unsplash โ†ฉ

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.