akeep / nanopass-framework

The new nanopass framework; an embedded DSL for writing compilers in Scheme
MIT License
321 stars 42 forks source link

Mutually recursive nonterminals are unsupported and unchecked #6

Closed akeep closed 11 years ago

akeep commented 11 years ago

When a language contains mutually recursive language forms, it loops indefinitely, rather than either a) reaching a fixed point or b) raising an error.

For example the trivial language L:

(define-language L (Command (c) e) (Expression (e) c))

never finishes expansion.

My inclination is to raise an error, because I'm not sure how mutually recursive nonterminals should best be handled, particularly in the auto-generation case where we would potentially build mutually recursive procedures in generated passes that loop indefinitely, though hopefully it would work out.

Part of my inclination is also that I'm not sure when it would be useful, though it is possible that we could support it if it was truly useful.

akeep commented 11 years ago

Decided to go ahead and have this raise an error for now. If there is a compelling reason, it can be changed, but will require some clean-up and testing in other code, along with some changes to how the predicates are built.

eholk commented 11 years ago

I think raising an error is the right thing to do.