shakespeare-parrot / manual.txt

Full commit
gabriele renzi 0ee7ce9 

gabriele renzi a14419f 

gabriele renzi 0ee7ce9 

gabriele renzi a14419f 

gabriele renzi 0ee7ce9 

The language is pretty simple:

 #! an optional she bang line

 a title, terminated by a dot, that may span multiple lines.

 charname, a valid name with ignored descr.
 other, a valid shakespeare char.
 Act I: contains scenes, a description.
 Scene I: contains events, is a label.
 [enter char and char]
 [enter char]
 char: sentence. sentence! sentence?
 other: sentence!
 [exit foo]
 [exeunt foo and foo]
sentences may be:
* proove <value> # prints "ok <value>"

* plan <value> # prints "plan <value>"

* remember <value> # push <value> in the spoken person stack

* let us proceed|return to scene <label> # goto

* <be> <value> better|worse|as good as <value> # sets condition flag

* if so|not, <sentence> # if|unless stmt checking the flag

* input 

** open your mind, # read a char
** listen to your heart # read a number

* output
** open your heart # print the number
** speak your mind # print the char

* you are <value> # assign a value
* recall <a string> # pop the value in the stack

A value is either a 
* constant expressed as
 positive|neutral name  = 1
 negative name = -1
 nothing|zero = 0
that is dobuled by the adjectives in front of it

a pretty king = 2
an ugly pig = -2

* computation
 the sum of <v> and <v>
 the difference between <v> and <v>
 the square of <v>
 twice <v>

* a reference to another character's value

 othello, you, me

You can use the interactive loop (run the interpreter with no args)
to check how statements are parsed.

Notice that programs develop through usage of 
first_persons and second_persons, so for example

juliet: you are nothing #assigns 0 to the spoken person
romeo: you are as good as me # assign 0 to juliet

Characters have both a main value (assigned) and a 
stack value where values are pushed with "remember".
When the "recall" statement gets in the current value of 
the character is replaced by that obtained by pushing the 

juliet: you are nothing #assigns 0 to the spoken person
romeo: You are a pig! # -1
       Remember me.    # 0 in stack, -1 stays as value
       Recall your ancestry! # empty stack, 0 as value

Notice that everything afte 'recall' is ignored up to the sentence terminator.

Please see the test suite and the examples/* files for 
further information.

The file src/parsers/ is the reference for 
the available statements, while src/parser/ 
shows what is considered good or bad, what are the valid 
characters and what are the valid adjectives, articles and pronouns.