All Projects → aNNiMON → Own-Programming-Language-Tutorial

aNNiMON / Own-Programming-Language-Tutorial

Licence: MIT license
Репозиторий курса "Как создать свой язык программирования"

Programming Languages

java
68154 projects - #9 most used programming language
scala
5932 projects

Projects that are alternatives of or similar to Own-Programming-Language-Tutorial

jaws
Jaws is an invisible programming language! Inject invisible code into other languages and files! Created for security research -- see blog post
Stars: ✭ 204 (+114.74%)
Mutual labels:  interpreter, interpreted-programming-language
Swiftpascalinterpreter
Simple Swift interpreter for the Pascal language inspired by the Let’s Build A Simple Interpreter article series.
Stars: ✭ 270 (+184.21%)
Mutual labels:  interpreter, lexer
aria
Expressive, noiseless, interpreted, toy programming language
Stars: ✭ 40 (-57.89%)
Mutual labels:  interpreter, lexer
malluscript
A simple,gentle,humble scripting language for mallus, based on malayalam memes.
Stars: ✭ 112 (+17.89%)
Mutual labels:  interpreter, lexer
Monkey Rust
An interpreter for the Monkey programming language written in Rust
Stars: ✭ 174 (+83.16%)
Mutual labels:  interpreter, lexer
scheme.js
Scheme语言解释器的JavaScript语言实现
Stars: ✭ 57 (-40%)
Mutual labels:  interpreter, programing-language
pascal-interpreter
A simple interpreter for a large subset of Pascal language written for educational purposes
Stars: ✭ 21 (-77.89%)
Mutual labels:  interpreter, lexer
MonkeyLang.jl
"Writing an Interpreter in GO" and "Writing a Compiler in GO" in Julia.
Stars: ✭ 30 (-68.42%)
Mutual labels:  interpreter, lexer
Lioness
The Lioness Programming Language
Stars: ✭ 155 (+63.16%)
Mutual labels:  interpreter, lexer
Rs Monkey Lang
Monkey Programming Language written in Rust.
Stars: ✭ 80 (-15.79%)
Mutual labels:  interpreter, lexer
fayrant-lang
Simple, interpreted, dynamically-typed programming language
Stars: ✭ 30 (-68.42%)
Mutual labels:  interpreter, lexer
types-and-programming-languages
C++ Implementations of programming languages and type systems studied in "Types and Programming Languages" by Benjamin C. Pierce..
Stars: ✭ 32 (-66.32%)
Mutual labels:  interpreter, lexer
esoo
Like the Programming Languages Zoo but with esoteric languages.
Stars: ✭ 18 (-81.05%)
Mutual labels:  interpreter, interpreted-programming-language
Mico
Mico ("Monkey" in catalan). Monkey language implementation done with C++. https://interpreterbook.com/
Stars: ✭ 19 (-80%)
Mutual labels:  interpreter, lexer
Cub
The Cub Programming Language
Stars: ✭ 198 (+108.42%)
Mutual labels:  interpreter, lexer
monkey
The Monkey Programming Language & Interpreter written in PHP.
Stars: ✭ 21 (-77.89%)
Mutual labels:  interpreter, lexer
gpp
General PreProcessor
Stars: ✭ 25 (-73.68%)
Mutual labels:  interpreter
endbasic
BASIC environment with a REPL, a web interface, a graphical console, and RPi support written in Rust
Stars: ✭ 220 (+131.58%)
Mutual labels:  interpreter
forthscript
Forthscript programming language interpreter
Stars: ✭ 16 (-83.16%)
Mutual labels:  interpreter
fint
.NET CIL interpreter written in simple subset of F#
Stars: ✭ 50 (-47.37%)
Mutual labels:  interpreter

OwnLang

Build Status

OwnLang - dynamic functional programming language inspired by Scala and Python. Available for PC, Android and Java ME devices.

Installing

Free Pro Desktop
Free Pro v1.5.0

Also available as AUR package:

yay -S ownlang

Key features

Higher-order functions

Functions are values, so we can store them to variables for operating.

operations = {
  "+" : def(a,b) = a+b,
  "-" : def(a,b) = a-b,
  "*" : def(a,b) = a*b,
  "/" : ::division
}

def division(v1, v2) {
  if (v2 == 0) return "error: division by zero"
  return v1 / v2
}

for name, operation : operations {
  println "2 " + name + " 3 = " + operation(2, 3)
}

Pattern Matching

Pattern matching with value pattern, tuple pattern, list pattern and optional condition.

def factorial(n) = match n {
  case 0: 1
  case n if n < 0: 0
  case _: n * factorial(n - 1)
}

def fizzbuzz(limit = 100) {
  for i = 1, i <= limit, i++ {
    println match [i % 3 == 0, i % 5 == 0] {
      case (true, false): "Fizz"
      case (false, true): "Buzz"
      case (true, true): "FizzBuzz"
      case _: i
    }
  }
}

// run
fizzbuzz()

Functional data operations

Operate data in functional style.

use ["std", "functional"]

nums = [1,2,3,4,5,6,7,8,9,10]
nums = filter(nums, def(x) = x % 2 == 0)
// Squares of even numbers
squares = map(nums, def(x) = x * x)
foreach(squares, ::echo)
// Sum of squares
sum = reduce(squares, 0, def(x, y) = x + y)
println "Sum: " + sum
// Same using stream
println "Sum: " + stream(range(1, 11))
  .filter(def(x) = x % 2 == 0)
  .map(def(x) = x * x)
  .reduce(0, def(x, y) = x + y)

Operator overloading

Why not?

use ["std", "types", "math"]

def `..`(a, b) = range(a, b)
def `**`(a, b) = int(pow(a, b))
for y : 1 .. 10 {
  println sprintf("2 ^ %d = %d", y, 2 ** y)
}

Network module

Easy async HTTP requests with http module.

use "std"
use "http"
use "functional"

// GET request
http("https://api.github.com/events", def(r) {
  use "json"
  events = jsondecode(r)
  println events[0]
})

// POST request
http("http://jsonplaceholder.typicode.com/users", "POST", {
  "name": "OwnLang",
  "versionCode": 10
}, ::echo)

// PATCH request
http("http://jsonplaceholder.typicode.com/users/2", "PATCH", {"name": "Patched Name"}, ::patch_callback)

def patch_callback(v) {
  println v
}

Language specification

English and Russian

Examples

Build

Build using Gradle ./gradlew dist

or take a look to latest release for binaries.

Run

To run script use command

java -jar OwnLang.jar -f input.own

or

java -jar OwnLang.jar < input.own

License

MIT - see MIT licence information

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].