8000 GitHub - baines/lang: Toy programming language
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

baines/lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A toy programming language, tentatively called EL3 (embedded lisp-like language)

The main goal behind it is to create a very simple scripting language for C++ programs to use, with a similar syntax to lisp. It likely won't ever be a serious alternative to a proper scripting language; this is mostly just a learning excercise about creating programming languages.

Will use ( ) style lists for calling functions with arguments, and { } for blocks which aren't evaluated immediately (and can be used to create functions). The formal language grammar is still up in the air.

It will only have local storage on a stack. Non-scoped allocation would need to be done C++ side and exposed via native functions.

Probable built-in functions to add:

  • standard operators, +, -, *, /, %, <, >, == etc.
  • 'def' or 'let' style function to add stuff to the symbol table.
  • conditionals like 'if', loops with 'for', 'while' etc.

Trivial currently working example programs:

1 + 2 using a lambda function

({ :x -> + x 1 } 2)

double numbers in a list

(map [1 2 3] { :x -> * 2 x })

count down from 10

(let [:x 10] {
    while { x } {
        (echo x)
        (= :x (- x 1))
    }
})

About

Toy programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0