Re: [stack] Is this language concatenative?
Michael Nedzelsky <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2 May 2007 02:31 am, William Tanksley, Jr wrote:
> But I think the ability to include program literals is obviously
> useful. And there's some use in insuring that the program literals are
> in the same (concatenative) language as you're coding it.
> So it seems to me that a non-flat concatenative language is still
> useful.
I completely agree.
> And I don't see why it should be impossible to define
> formally... Especially since we haven't even defined a flat
> concatenative language formally. (We seem to have exceptions to every
> proposed definition, although IMO several have come very close.)
Below is my attempt to define a flat concatenative language. It is only an
attempt, so any critical remarks are welcome.
Let T be a non-empty set of terminal symbols.
T* denotes the set of all strings over alphabet T, where e \in T* denotes
the empty string. Let L be a language over alphabet T, i.e. L \subseteq T*.
Definition:
u \in L is simple <=> (\forall x, y \in L) u = xy --> x=e \/ y=e
Simple(L) = { u \in L | u is simple } - set of all simple elements of L.
The language L \subset T* is a (syntactically) flat concatenative language if
and only if it satisfies the following requirements:
1) e \in L
2) (\forall x, y \in T*) x,y \in L --> xy \in L
3) The unique factorization property holds for elements of L. That is, every
element other than empty can be factored into simple elements in exactly one
way.
4) The set of all simple elements of L forms a regular language, i.e.
the language Simple(L) can be defined by some regular expression.
This definition is only about syntax. What can be said about semantics?
Definition.
Let L be a a (syntactically) flat concatenative language.
Let s be a mapping from L into some semantic domain M.
The mapping s defines semantics of L, so for program x \in L s(x) is a meaning
of x.
(In real situation M can be some algebraic system with some operations and
relations on base set).
The language L is a flat concatenative language with respect to semantics s if
and only if there is a mapping b: M x M -> M such that
I) for every x, y \in L s(xy) = b(s(x), s(y))
II) b is associative
Notes:
I) means that for every x, y \in L the meaning of program xy is uniquely
determined by the meaning of programs x and y
II) means that for x, y, z \in L the two ways to determine the meaning of xyz
(by meaning of xy and meaning of z, by meaning of x and meaning of yz) yield
the same result.
Michael Nedzelsky
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/concatenative/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/concatenative/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/