Skip to content

rozele/ExpressionScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExpressionScript

Code-as-data compiler for TypeScript.

Examples

To test out the examples, compile the project with:

tsc --target es5 src\compiler\compile.ts

Then run the compiler with:

node bin\cli examples\simple.q.ts

The input file simple.q.ts:

import {
    Expression,
    LambdaExpression,
} from '../src/expressions/Expression';

function foo<TFunction extends Function>(f: LambdaExpression<TFunction>) {
    console.log(f.compile()());
}

foo(<LambdaExpression<() => number>>(() => 42));

Will be converted to the output file simple.ts:

import {
    Expression,
    LambdaExpression,
} from '../src/expressions/Expression';

function foo<TFunction extends Function>(f: LambdaExpression<TFunction>) {
    console.log(f.compile()());
}

foo(Expression.lambda<() => number>(Expression.constant(42), []));

About

Code-as-data compiler for TypeScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published