Suppose we have the following grammar:
#x = INT | (#x + #x)
INT = 0 | 1
Suppose now I would like to make an infinite stream that "contains" every possible form of #x.
Here's what I can think of so far:
atomic :: [String]
atomic = ["0", "1"]
--------------------
plus :: String -> String -> String
plus x1 x2 = "(" ++ x1 ++ "+" ++ x2 ++ ")"
--------------------
makeInfiniteStream :: [String]
makeInfiniteStream = atomic : --something
I'm not quite sure what goes on the other other side of the colon. I assume it has to involve a function call, but I don't quite see it yet.
Thanks.