Git Product home page Git Product logo

edu's Introduction

logo

edu - Amharic programming language!

edu is a minimal, transpiled programming language with not so easy syntax :P. edu transpiles to plain javascript.

If you want to try it out, here is a playground

How does edu work?

edu-process

  • 1) Lexer/ Tokenizer

    • A tokenizer splits the input into a stream of larger units called tokens. This happens in a separate stage before parsing.
  • 2) Parser

    • Parsers turn strings of characters into meaningful data structures (like a JSON object). The returned
  • 3) Generator

    • Generator takes the parsed object and changes it to the desired language(Javascript) which in turn will be executed to generate a machine code.

Features

  • null
  • variables
  • boolean
  • numbers
  • strings
  • array
  • if condition
  • loop
  • lambda functions
  • comments

Examples

Null

  ባዶ := null
  //transpiled version of the code
  var ባዶ = null

Boolean

  ቡሊያን := እውነት
  //transpiled version of the code
  var ቡሊያን = true

Number

  ቁጥር := 100
  //transpiled version of the code
  var ቁጥር = 100

String

  ቁምፊዎች := "ደብዳቤ"
  //transpiled version of the code
  var ቁምፊዎች = "ደብዳቤ"

Array

  ድርድር := [1 "ሁለት" እውነት]
  //transpiled version of the code
  var ድርድር = [1, "ሁለት", true]

If condition

  መልስ := ከሆነ(እውነት 
              () => "እውነት ነው"
              () => "ውሸት ነው"
          )
  //transpiled version of the code
  var መልስ = ከሆነ( true, function (  ) {
    return "እውነት ነው"
  }, function (  ) {
    return "ውሸት ነው"
  } )

Loop

  ለእያንዳንዱ(ክልል(0 6) አውጣ)
  //transpiled version of the code
  ለእያንዳንዱ( ክልል( 0, 6 ), አውጣ )

Lambda function

  ተግባር := () => "ይሰራል"
  //transpiled version of the code
  var ተግባር = function (  ) {
    return "ይሰራል"
  }

A working fibonacci sequence example

  ፋይቦናቺ := (n) => {
    ከሆነ(ያንሳል(n 2)
        () => n
        () =>
            ከሆነ(እኩል_ነው(n 2)
                () => 1
                () =>
                    ደምር(
                        ፋይቦናቺ(ቀንስ(n 1))
                        ፋይቦናቺ(ቀንስ(n 2))
                    )
            )
        )
  }
  //transpiled version of the code
  var ፋይቦናቺ = function ( n ) {
    return ከሆነ( ያንሳል( n, 2 ), function (  ) {
      return n
    }, function (  ) {
      return ከሆነ( እኩል_ነው( n, 2 ), function (  ) {
        return 1
      }, function (  ) {
        return ደምር( ፋይቦናቺ( ቀንስ( n, 1 ) ), ፋይቦናቺ( ቀንስ( n, 2 ) ) )
      } )
    } )
  }
  
  አውጣ(ፋይቦናቺ(10)) // 55 <= correct answer

edu's People

Contributors

myonim avatar

Stargazers

 avatar  avatar

Watchers

 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.