[View] [Edit] [Attachments] [History] [Home] [Changes] [Search] [Help]

Manual 2002 Sep

Install

If you just want to play LanguageGame, try Demonstration.
But you want to use in standalone Squeak, Please fill in the file
and doit
GLauncher new open

window

Missing File (/ggame/uploads/GGameWindow.png)

context menu

Missing File (/ggame/uploads/WindowMenu.png)
Missing File (/ggame/uploads/Gtiles.png)


Let's play


Hello world

Language game has two pane, top pane is grammar pane described grammar and bottom pane is sample pane which you can write sample string. To play LanguaageGame is to make a grammar in grammar pane then put sample string fitted the grammar.
(Of course, you can first write sample string then next grammar)
Let's make a grammar to recognize 'Hello world'.

At first, put grammar pane as

greeting : Hello world

then accept this grammar (alt + s). It is maked as new grammar.
This grammar means 'Hello world' is as 'greeting'

Next, you should write a sample string
Hello world
in sample pane and push enter. The sample will be parsed and be shown syntax tree.

If you put another string like
Bye world
and parser reject and pop up red error tree.

Recursive Hello world

In this example

greeting : Hello
greeting : greeting world

matches 'Hello world', and in addition, the string
Hello world world world ... ('Hello' any numbers of 'world')
is matched. why?
In this example, definition of greeting uses a term of 'greeting' itself. Like this, the definition include itself is called 'recursive'. You can see the construction as tile tree easy.

Action


expr : expr inc [ :a :b | a + 1 ]
expr : number

In this example, a part enclosed in [] called 'action'.
This grammar meens the language which can add number '1'. You can put the sample pane like
10 inc inc
and then click 'expr' tile of generated tree. Now result 12 is popped up.

There is secret in 'a + 1' in action. In the fact, each word parsed as symbol (called 'node') has value, then you can see the value as click the tile. The value has rules bellow.


Additionary, :a is represented first symbol on right hand in the rule, and :b is represented second.

Moving morph


You can put the action any Smalltalk expression. And LanguageGame has blaata function, You can drop ScriptEditorMorph to grammar pane and put action like
[scripteditor1300 tryMe]
In this function, You can make a grammar to use any morphic object.


gg
propella home