Skip to content

Library to write AST builders and computation expressions for Scala 3

Notifications You must be signed in to change notification settings

Ef55/scala-expression-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exproc (Expression processor) library

Tired of having to write a full-blown compiler for your XML-based plane control language ? Tired of writing monadic-style computations no-one understands ?

val willInline = maybeName
    .flatMap(name => {
        env(name).map(fun => {
            (fun, size(fun.body))
        })
    })
    .filter(_._2 <= funLimit) 
    .map(_._1)
    .filter(fun => sameLen(fun.args, args))

Look no further, Exproc will ease your life.

val willInline = maybeFlow {
    val name = ! maybeName
    val fun = ! env(name)

    if (size(fun.body) <= funLimit && sameLen(fun.args, args)) then
        Some(fun)
    else
        None
}

Examples

Computation expressions

Inspired from F#'s computation expressions, some possible monadic-flows are available in the tests.

AST builders

Two examples are available, both based upon tiny languages used in videogames:

About

Library to write AST builders and computation expressions for Scala 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages