PistonDevelopers / meta

A DSL parsing library for human readable text documents
MIT License
90 stars 5 forks source link

Add support for "sub rule transformation" #278

Closed bvssvni closed 8 years ago

bvssvni commented 8 years ago

For example:

0 point = ["(" .$:"x" "," .$:"y" ")"]
1 two_points = [point:"a" "," point:"b"]
2 dot = ["dot" "(" two_points .$(a.x * b.x + a.y * b.y):"sum" ")"]

This would compute the dot product of dot((1,2),(2,1)) and return "sum": 4.

The transformation could be evaluated externally.

bvssvni commented 8 years ago

One problem is that the meta language would become a lot more complicated.