             }
         }
         return false
+    }
+    
+    func expression(for tokenName:String, in grammar:_STLR.Grammar) throws ->_STLR.Expression {
+        if let group = group {
+            return group.expression
+        } else if terminal != nil {
+            return _STLR.Expression.sequence(sequence: [self])
+        } else if let identifier = identifier {
+            if identifier == tokenName {
+                throw TestError.interpretationError(message: "Recursive inline definition of \(tokenName)", causes: [])
+            }
+            return grammar[identifier].expression
+        }
+        
+        fatalError("Unknown expression type")
     }
 }
 

    /// The `Behaviour` of the rule
    public var behaviour : Behaviour {
        return Behaviour(kind, cardinality: cardinality, negated: isNegated, lookahead: isLookahead)
    }
    
    /**

        }
    }

    fileprivate func embeddedIdentifier(_ tokenName:String)->_STLR.Element?{
        switch self {
        case .element(let element):
            return element.embeddedIdentifier(tokenName)
        case .sequence(let elements), .choice(let elements):
            for element in elements{
                if let element = element.embeddedIdentifier(tokenName){
                    return element
                }
            }
            return nil
        }
    }
    
    public func directlyReferences(_ identifier:String, grammar:_STLR.Grammar, closedList:inout [String])->Bool {
        for element in elements {
            if element.directlyReferences(identifier, grammar: grammar, closedList: &closedList){
