Re: Spoken programming language
From: | Gary Shannon <fiziwig@...> |
Date: | Saturday, January 3, 2009, 8:29 |
--- On Fri, 1/2/09, Philip Newton <philip.newton@...> wrote:
> From: Philip Newton <philip.newton@...>
> > I don't think that you quite understand me. I
> meant that I wanted to make a
> > human language based on programming syntax not the
> word variety.
>
> How would you do that, though?
>
> How would you distinguish between past and non-past, for
> example? (Or
> is this a distinction you're not interested in making?)
>
> How would you modify nouns ("the red apple" vs.
> "the green apple")?
Just off the top of my head, let "red" be a function, called with the thing to be
modified with redness: red(apple). Let tense be a function applying its
modification to an action, which in turn applies the action to a thing:
past(run(Johnny)).
Then the whole statement could be made into either an assertion of fact or a question:
Assert(past(run(Johnny))); // asserts that Johnny ran
Query(past(run(Johnny))); // queries whether or not it is true that Johnny ran.
Functions could easily be nested to express more complex assertions, imperatives, or queries:
Imperative(eat(NULL,red(apple)));
Query(eat(Johnny,red(apple)));
Assert(past(eat(Johnny,red(apple))));
Assert(past(steal(which(boy, past(with(rock, break(boy, window))), for(belong(me, bicycle(lock)), key))));
[The boy who broke the window with a rock stole the key to my bicycle lock.]
--gary
Replies