3 ms·
Is there an example of such a language?
by qwerty456127 8y ago
Is there an example of such a language?
- olooney 8y agoIt appears that the most important restriction is on recursion: > This is what guarantees the language is visibly pushdown: all recursion is explicitly delineated by special symbols. > Plain recursion isn't allowed. Only two restricted kinds of recursion are available: guarded recursion and expression recursion. So the Owl grammar itself qualifies: https://github.com/ianh/owl/blob/master/grammar.owl https://github.com/ianh/owl/blob/master/grammar.owl JSON certainly qualifies: https://github.com/ianh/owl/blob/master/test/json.owl https://github.com/ianh/owl/blob/master/test/json.owl I think the full JavaScript language would have qualified in the past, when anonymous functions could only be the explicitly delimited "function() {}"... but now with ES6 we have fat arrow functions (for example "(x,y) => x+y") so I think modern JavaScript can no longer be parsed with Owl. That's because you can write something like "f = x => y => z => x+y+z" which has no guard nor can it be parsed with expression recursion. I do not think you can do a C-like language because of function types. But you can do a simpler, C-like language, for which they have an good example in the test directory: https://github.com/ianh/owl/blob/master/test/something.owl https://github.com/ianh/owl/blob/master/test/something.owl