Open jarble opened 8 years ago
Hello! Yes and no. See dcg.rb and dcg2.rb in examples/. Both of them are examples for these. The first one is a nicer syntax, it works alike, but it's inefficient for long inputs. The second one is semantically equivalent, but the syntax is not so nice. It's actually just the Rubylog version of the semantics of how the prolog DCG preprocessor translates DCGs.
So currently there is no simple syntax for real DCGs. I've thought about it a lot, but didn't find an easy solution. If you have an idea, tell me, and if someone can implement it, I'm open to adding it to the language. But I'm quite busy with other projects, so I cannot promise to work too much on it.
In Prolog, it is possible to define definite clause grammars like this one:
Does an equivalent notation exist in Rubylog?