Skip to content

Commit

Permalink
cons, uzh info
Browse files Browse the repository at this point in the history
  • Loading branch information
true-grue committed Oct 21, 2018
1 parent 7380dad commit 1de655e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -16,3 +16,5 @@ raddsl is inspired by:
* [Stratego/XT](https://en.wikipedia.org/wiki/Stratego/XT)

See *examples* folder for some examples of how to use raddsl.

See also [Uzh compiler](https://github.com/true-grue/uzh).
5 changes: 3 additions & 2 deletions raddsl/rewrite.py
Expand Up @@ -120,10 +120,11 @@ def walk(tree):
return walk


def cons(f, g):
def cons(h, t):
def walk(tree):
if type(tree.out) in tuple_or_list and tree.out:
return match(tree, f, tree.out[0]) and match(tree, g, tree.out[1:])
m = match(tree, h, tree.out[:len(h)])
return m and match(tree, t, tree.out[len(h):])
return False
return walk

Expand Down

0 comments on commit 1de655e

Please sign in to comment.