Skip to content

Python-like language and interpreter framework for describing and evaluating decision trees

License

Notifications You must be signed in to change notification settings

bartfrenk/tree-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TreeLang

Description

A (non-Turing complete) language for describing decision trees, with syntax similar to Python. Loosely inspired by AppNexus' Bonsai language.

The language has a few design goals:

  • It should be simple and intuitive to use for people with some exposure to Python,
  • It should be difficult to write programs that fail.

The language itself is statically typed, and the type checker allows for the types of the context macros (the program elements with prefix $) to be provided by an external provider.

The repository provides an interpreter that executes programs inside a monad. This allows for the values of context macros to be externally provided.

Example

This example does not run yet. It is an indication of where to project is going.

placholder title: text
placeholder pancake: image

if $creative.size == (640, 480):
    if $geo.city == "Amsterdam":
        if $weather.temperature > 20:
            pancake = "amsterdam-pancake.png"
            title = "Summer in Amsterdam!"
        end
    elif $geo.city == "Paris":
        pancake = "paris-pancake.png"
    else:
        pancake = "small-pancake.png"
    end
end

if $time.part == "evening":
    title = "Good evening"
else:
    title = "Good day!"
end

Project

Administration for the project is kept in a separate org-mode document: project.org.

References

  1. Benjamin C. Pierce. Types and programming languages. The MIT press. 2002.
  2. Stephen Diehl. Implementing a JIT compiled language with Haskell and LLVM. 2017. http://www.stephendiehl.com/llvm/

About

Python-like language and interpreter framework for describing and evaluating decision trees

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published