Skip to content
/ edu Public

A transpiled Amharic programming language with not so easy syntax. edu is transpiled to javascript.

Notifications You must be signed in to change notification settings

MyoniM/edu

Repository files navigation

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

About

A transpiled Amharic programming language with not so easy syntax. edu is transpiled to javascript.

Topics

Resources

Stars

Watchers

Forks