Re: [stack] A small example of a (possibly concatenative) language for primitive recursive functions of one variable.
"William Tanksley, Jr" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
Michael Nedzelsky <[email protected]> wrote: > William Tanksley, Jr wrote: > > In the case of your language, the (S+S) form means that programs > > cannot be built solely by concatenating simple forms (flat > > concatenative) nor by passing programs to other programs (non-flat > > concatenative). > So the possibility of passing programs to other programs must be a part of > definition of non-flat concatenative language? I'd have to say no... That's semantic, not syntactic, so it can't be part of a syntactic definition. I was incorrect to suggest that. However, we still have the problem that expressions of the form (S+S) cannot be built by concatenating valid programs. Your definition allows them simply because it doesn't "look inside" the parentheses. Of course, it also doesn't look inside square brackets, even though if you were to look inside those you'd see another valid program (in Joy and in your grammar). > Let's consider the next example. I'm glad you're here. This is providing some definitional rigor I certainly needed. Thank you for putting the thought into this. > Terminal symbols: a, b, [, ] > Production rules: > S --> e | a | b | S S | [ S ] > Let L denote the language which generated by this grammar. > The semantics of this language as follows: > let M be mapping from L to the set of all primitive recursive functions, such > that > 1) M(a) = f_a > 2) M(b) = f_b > 3) (\forall x,y \in L) M(xy) = M(x) M(y) # i.e. composition of the functions > M(x) M(y) > 4) (\forall x \in L) M( [x] ) = J(M(x)) # i.e. iteration of M(x) > M maps L onto the set of all primitive recursive functions of one variable. > Is the language L a concatenative language? I would need to understand more about "iteration". Right now I really don't know what it means. If my hunch is right, though, this is a concatenative language. If so, this is rather interesting... It's very different from the other concatenative languages I've looked at. > Michael Nedzelsky -Billy