Skip to content

Functional interpreted language in F# and C#

Notifications You must be signed in to change notification settings

khaledmousa/Dala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dala

Dala is an attempt at an interpreted functional language where there are no variables, only single-parameter functions.

The current implementation is still in very early stages: it only supports integer values and very basic flow.

The language grammar uses F#'s FsLex and FsYacc, the interpreter is written in F#, and the REPL is in C#.

Statements in the REPL console are evaluated after a semicolon is entered, the language itself has no semicolons yet.

Adding two numbers

Below is a simple example of a function that adds two numbers:

Example add

The function add takes one parameter and returns another function, addToN, which also takes a single parameter and adds it to the parameter of add. So, calling add(3), for example, returns a function that takes a nunmber and adds it to 3 and returns the result; so calling add(3)(4) passes 4 to the function returned from add(3) and returns 7.

Recursion

Signle condition if-statements and recursion are also supported, as shown in the example below with a factorial function:

Example add

About

Functional interpreted language in F# and C#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published