Skip to content

Commit

Permalink
Added samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Baltasarq committed May 2, 2016
1 parent 87f3b08 commit 1ac5e88
Show file tree
Hide file tree
Showing 5 changed files with 334 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions samples/init.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Pooi [Prototype-based, object-oriented interpreter]

type in your message
try "Root list", "help" or "about" to start


> (anObject copy) rename "Point"
anObject was copied into Root as 'Root.anObject1'
Root.anObject1 renamed to Root.Point


> (anObject copy) rename "TraitsPoint"
anObject was copied into Root as 'Root.anObject2'
Root.anObject2 renamed to Root.TraitsPoint


> Point.x = 0
'x' set in Root.Point


> Point.y = 0
'y' set in Root.Point


> (anObject copy) rename "Persona"
anObject was copied into Root as 'Root.anObject3'
Root.anObject3 renamed to Root.Persona


> Point.parent = TraitsPoint
'parent' set in Root.Point


> Persona.edad = 42
'edad' set in Root.Persona


> persona.nombre = "Baltasar Garc�a Perez-Schofield"
Error: Attribute not found: 'persona' in 'Root'

> Persona.nombre = "Baltasar Garc�a Perez-Schofield"
'nombre' set in Root.Persona


> (anObject copy) rename "TraitsPersona"
anObject was copied into Root as 'Root.anObject4'
Root.anObject4 renamed to Root.TraitsPersona


> Persona.parent = TraitsPersona
'parent' set in Root.Persona


> TraitsPoint.shift = {d: self.x = (self.x + d); self.y = (self.y + d)}
'shift' set in Root.TraitsPoint


> Point shift 5
Root.Point.x and Root.bin.lit16 added, giving 5
'x' set in Root.Point
Root.Point.y and Root.bin.lit19 added, giving 5
'y' set in Root.Point



64 changes: 64 additions & 0 deletions samples/sesion_pooi_alejandro.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
> ( anObject copy ) setName "Persona"
Persona = Object Persona = {
parent = Object Object : {}

}

> ( Persona createChild ) setName "alejandro"
Persona alejandro = {
parent = Object Persona : {}

}

> alejandro.nombre = "Alejandro Magno"
Persona alejandro = {
parent = Object Persona : {}
nombre = String nombre : {}
"Alejandro Magno"

}
> alejandro.edad = 32
Persona alejandro = {
parent = Object Persona : {}
nombre = String nombre : {}
"Alejandro Magno"
edad = Integer edad : {}
32

}
> alejandro list
> ( alejandro copy ) setName "hefestion"
hefestion = Persona hefestion = {
parent = Object Persona : {}
nombre = nombre nombre : {}
"Alejandro Magno"
edad = edad edad : {}
32

}
> alejandro list
> hefestion list
> hefestion.nombre = "Hefestion"
Persona hefestion = {
parent = Object Persona : {}
nombre = String nombre : {}
"Hefestion"
edad = edad edad : {}
32

}

> alejandro.amigo = hefestion
Persona alejandro = {
parent = Object Persona : {}
nombre = String nombre : {}
"Alejandro Magno"
edad = Integer edad : {}
32
amigo = Persona hefestion : {}

}
> alejandro str
{ nombre = "Alejandro Magno" edad = 32 amigo = { nombre = "Hefestion" edad = 32 } }
> hefestion str
{ nombre = "Hefestion" edad = 32 }
179 changes: 179 additions & 0 deletions samples/sesion_pooi_punto.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
Pooi [Prototype-based, object-oriented interpreter]

type in your message
try "Root list", "help" or "about" to start


> (anObject copy) setName "Punto2D"
anObject was copied into Root as 'anObject3'
anObject3 renamed to Root.Punto2D


> Punto2D.x = 0
> Punto2D.y = 0
> Punto2D.str = {: ( ( self.x str ) + ", " ) + ( self.y str ) }


> (anObject copy) setName "Punto3D"
anObject was copied into Root as 'anObject4'
anObject4 renamed to Root.Punto3D


> Punto3D.x = 0
> Punto3D.y = 0
> Punto3D.z = 0
> Punto3D.str = {: ( ( ( ( self.x str ) + ", " ) + ( self.y str ) ) + ", " ) + (self.z str) ) }


> Root.Punto2D
{ x = 0 y = 0 }

> Root.Punto3D
{ x = 0 z = 0 y = 0 }


> (anObject copy) setName "p1"
anObject was copied into Root as 'anObject5'
anObject5 renamed to Root.p1


> p1.parent = Punto2D
Punto2D p1 = {
parent = Object Punto2D : {}

}


> p1
{ x = 0 y = 0 }


> p1.parent = Punto3D
Punto3D p1 = {
parent = Object Punto3D : {}

}


> Root.p1
{ x = 0 z = 0 y = 0 }


> p1.x = 100
Punto3D p1 = {
x = Int Int0 : {}
100
parent = Object Punto3D : {}

}


> p1.y = 10
Punto3D p1 = {
x = Int Int0 : {}
100
parent = Object Punto3D : {}
y = Int Int0 : {}
10

}


> p1
{ x = 100 y = 10 z = 0 }


> p1.parent = Punto2D
Punto2D p1 = {
x = Int Int0 : {}
100
parent = Object Punto2D : {}
y = Int Int0 : {}
10

}


> p1
{ x = 100 y = 10 }


> p1 list
Punto2D p1 = {
x = Int Int0 : {}
100
parent = Object Punto2D : {}
y = Int Int0 : {}
10

}


> p1.parent = Punto3D
Punto3D p1 = {
x = Int Int0 : {}
100
parent = Object Punto3D : {}
y = Int Int0 : {}
10

}


> p1.z = 5
Punto3D p1 = {
x = Int Int0 : {}
100
parent = Object Punto3D : {}
z = Int Int0 : {}
5
y = Int Int0 : {}
10

}


> p1
{ x = 100 z = 5 y = 10 }


> p1.parent = Punto2D
Punto2D p1 = {
x = Int Int0 : {}
100
parent = Object Punto2D : {}
z = Int Int0 : {}
5
y = Int Int0 : {}
10

}


> p1
{ x = 100 z = 5 y = 10 }


> p1 list
Punto2D p1 = {
x = Int Int0 : {}
100
parent = Object Punto2D : {}
z = Int Int0 : {}
5
y = Int Int0 : {}
10

}


> Root.Punto3D.x
0


> Punto2D
{ x = 0 y = 0 }


> Punto3D
{ x = 0 z = 0 y = 0 }
11 changes: 11 additions & 0 deletions samples/sesion_pooi_rectangulo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
> (anObject copy) setName "Rectangulo"
> Rectangulo.lado1 = 0
> Rectangulo.lado2 = 0
> Rectangulo str
> ( Rectangulo createChild ) setName "r1"
> r1.lado1 = 100
> r1.lado2 = 100
> r1 str
> Rectangulo.area = {: self.lado1 * self.lado2 }
> Rectangulo area
> r1 area

0 comments on commit 1ac5e88

Please sign in to comment.