-
Notifications
You must be signed in to change notification settings - Fork 2
Example 1
Fernando Petrola edited this page Sep 15, 2023
·
27 revisions
//--------------------------------------------------------------------------{}
//---------------------- Humo Runtime Environment --------------------------{}
//--------------------------------------------------------------------------{}
[te{[t}mp]{emp]}
[co{[c}mmand]{ommand]}
[exec]{[run]}
[run]{[command]}
#class{new}
#method:{[me][thod]<*>instance:name.}
#property:{[prop][erty]<*>instance:name.}
#this.{[do][llar]<*>instance:name.}
#previous-value-of{<****>}
#new{<***>new}
#call{<**>}
<process-result>{<**>}
<**{<*}
<*>{$}
<..{<.}
<.>{}
[dollar]{$}
[do]{[do}
[llar]{llar]}
[method]{$}
[me]{[me}
[thod]{thod]}
[property]{$}
[prop]{[prop}
[erty]{erty]}
10[_x_]20{200}
30[_x_]40{1200}
[_x{[_}
_]{x_]}
--{<****}
[def1]{[}
[def2]{-}
#init-class{}
#close-class{[run]{<***> instance:name{<****>instance:name}}}
#class Rectangle
{
#init-class
#method:getArea
{
[run]{ --> multiplier:p1{#this.width} }
[run]{ --> multiplier:p2{#this.length} }
[run]{ --> instance:name{mult1} }
[run]{ --> new Multiplier }
[run]{ --> $mult1.multiply }
[run]{ --> area:result{<process-result>multiply:result} }
}
#property:width { --> rectangle:width }
#property:length { --> rectangle:length }
#close-class
}
#class Multiplier
{
#init-class
#method:multiply
{
[run]{ --> multiply:first{#this.firstValue} }
[run]{ --> multiply:second{#this.secondValue} }
[run]{ --> multiply:combined{$multiply:first [_x_] $multiply:second} }
[run]{ --> multiply:result{$multiply:combined} }
[run]{ --> multiply:first{#previous-value-of multiply:first} }
[run]{ --> multiply:second{#previous-value-of multiply:second} }
[run]{ --> multiply:combined{#previous-value-of multiply:combined} }
}
#property:firstValue { --> multiplier:p1 }
#property:secondValue { --> multiplier:p2 }
#close-class
}
#class Main
{
#init-class
#method:execute
{
[run]{ #this.m1 }
[run]{ #this.m2 }
}
#method:m1
{
[run]{ --> rectangle:width{10} }
[run]{ --> rectangle:length{20} }
[run]{ --> instance:name{rect1} }
[run]{ --> new Rectangle }
[run]{ --> $rect1.getArea }
[run]{ --> $area:result }
}
#method:m2
{
[run]{ --> rectangle:width{30} }
[run]{ --> rectangle:length{40} }
[run]{ --> instance:name{rect2} }
[run]{ --> new Rectangle }
[run]{ --> $rect2.getArea }
[run]{ --> $area:result }
}
#close-class
}
[temp]
{
[run]{ $instance:name{main1} }
[run]{ new Main }
[run]{ $main1.execute }
}
//--------------------------------------------------------------------------{}
//----------------------- End of application code --------------------------{}
//--------------------------------------------------------------------------{}