Archive for the Language Category

FTOP

Posted on Tuesday, November 28th, 2006 at 3:36 am

I want to design a programming paradigm that focus on fairy tale. Should I call it, FTOP Fairy tale oriented programming language. Why ? because most of the fairy tales are happy ending, so my programming paradigm should allow or force the programmer to be happier when they finish their job.

In my idea, a program should be the hybrid between pure OOP and prototype-based programming (e.g. wolf eat: girl.prototype(size=small, hat.type=hood, hat.color=red)) plus some indent-forced style of evil Python . This should allow to reuse a fairy tale. I mean, fox is mostly a bad guy, we should reuse them, right.

the program may be started and ended using tags like this

once upon a time

happily ever after

Well, let’s try a short program then, let’s use this tale

tale name: "Little Red Ridding Hood"
once_upon_a_time: {
   little_red_ridding = human clone:
                              prototype: {sex = woman,
                                          age = girl,
                                          size = little,
                                          living_place = country|village,
                                          appearance = prettiest}.
   mother = human clone:
                  prototype: {sex = woman,
                              age = adult,
                              mother_of = little_red_ridding,
                              living_place = little_red_ridding.living_place}.
   grandmother = human clone:
                       prototype: {sex = woman,
                                   age = old,
                                   mother_of = mother}.
   little_red_ridding_hood = cloth clone:
                                   prototype: {type = hood,
                                               color = red}.
   little_red_ridding prototype: {hat = little_red_ridding_hood}.
   cakes = food clone:
                prototype: {type = cake}.
   mother made: cakes
          said: "Go, my dear, and see how your grandmother is  doing,
                 for I hear she has been very ill. Take her a cake,
                 and this little pot of butter."
          to: little_red_ridding.
   grandmother prototype: {living_place = other_village}.
   little_red_ridding go: grandmother.living_place.
   wolf = animal clone:
                 prototype: {type = wolf}.
   little_red_ridding met: wolf.
   woodcutters =  human clone: many
                        prototype: {sex = man,
                                    age = adult}.
   wolf wanted: (eat: girl)
        but: (cannot because: woodcutters location: nearby)
        said: "where she was going"
        to: little_red_ridding.
   little_red_ridding know: !(talk: wolf)
                      said: "I am going to see my grandmother
                             and carry  her a cake and a little pot
                             of butter from  my mother."
                      to: wolf.
   wolf said: "Does she live far off?"
        to: little_red_ridding.
   little_red_ridding said: {"Oh I say,", "it is beyond that mill you see 
                              there, at the first house in the village."}
                      to: wolf.
   wolf said: {"Well,", "and I'll go and see her too. I'll go this way
                and go you that, and we shall see who will be there first."}
        to: little_red_ridding.
   wolf ran: fast
        gathered: nuts
        ran: (after: butterflies)
        gathered: (bouquets of:  flowers clone: many
                                         prototype: {size = little}).
    wolf knocked: grandmother.house.
    grandmother said: "Who's there?"
                to: wolf.
    wolf counterfeit: little_red_ridding.voice
           said: {"Your grandchild, Little Red Riding Hood,",
                  "who has brought you a cake and a little pot of butter
                   sent you by mother."}
           to: grandmother.
   grandmother prototype: {status = ill}
               said: "Pull the bobbin, and the latch will go up."
               to: wolf.
   wolf pulled: bobbin
        opened: door
        ate: grandmother
        shut: door
        get_into: bed.
   little_red_ridding knocked: door.
   wolf said: "Who's there?"
        to: little_red_ridding.
   little_red_ridding heard: wolf.voice
                      afraid: wolf.voice
                      believed: (grandmother cold: hoarse:)
                      said: "It is your grandchild Little Red Riding  Hood,
                             who has brought you a cake and a little pot of 
                             butter mother sends you."
                      to: wolf.
   wolf cried:
        soften: wolf.voice
        said: "Pull the bobbin, and the latch will go up."
        to: little_red_ridding.
   little_red_ridding pulled: bobbin
                      opened: door.
   wolf saw: (little_red_ridding came:)
        said: "Put the cake and the little pot of butter upon
               the stool, and come get into bed with me."
        to: little_red_ridding
        hide: (bedclothes under:).
   little_red_ridding took_off: her.cloth
                      moved_to: bed
                      amazed:
                      saw: (grandmother.nightClothes)
                      said: "Grandmother, what big arms you have!"
                      to: wolf.
   wolf said: "All the better to hug you with, my dear."
        to: little_red_ridding.
   little_red_ridding said: "Grandmother, what big legs you have!"
                      to: wolf.
   wolf said: "All the better to run with, my child."
        to: little_red_ridding.
   little_red_ridding said: "Grandmother, what big ears you have!"
                      to: wolf.
   wolf said: "All the better to hear with, my child."
        to: little_red_ridding.
   little_red_ridding said: "Grandmother, what big eyes you have!"
                      to: wolf.
   wolf said: "All the better to see with, my child."
        to: little_red_ridding.
   little_red_ridding said: "Grandmother, what big teeth you have got!"
                      to: wolf.
   wolf said: "All the better to eat you up with."
        to: little_red_ridding
        ate: little_red_ridding.
} happily_ever_after:

Errr well, it’s not happy ending, I should put grammatical error around here. Anyway, you got the idea 😀

I’ll try to show you another program later, maybe … snow white.