123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- but the {} pairs must match.
- }
-
- p 1
- p 2
- p 378
- p +108
- p -878
- p "Hello world\"
- "
- p `
- "Pop" goes the
- weasel's tail.
- `
- # Built in identfiers for type Bool or nil
- p !true !false !nil
- # And simple floating point constants, but no exponential notation, with type Float
- p +0.5
- p -7.000005
- # Lists can be created between [ ] and may be heterogenous or homogenous.
- # The [ ] must be space separated.
- # The type is Any[] if heterogenous,
- # p [ foo "bar" ]
- # The type is Int[] below
- # p [ 1 2 3 ]
- # A sequence of a lower case letter followed by anything that is not whitespace.
- # For example: this-IS*a/single+Word._
- # The value of a word is a string with the word itself.
- # If the word is at the beginning of the line it is invoked as a command.
- # Muesli's basic syntax is that of the command. Spaces separate the arguments.
- print "hello" world 7 0.9
- print ( mul 3 ( sum 5 7 ) )
- command {
- print "first block"
- } and also {
- print "second block"
- }
- type Door ( object locked Bool keys Item[] )
- to open [door Door key Item] Bool {
- if (contains (member door key) key) {
- set (member door open) true
- }
- }
- set a 10
- print (get a 10)
- upset a 10
- =a 10
- print $a
- =foo a
- =$foo 20
- print $a
- if (less a 10) {
- print "Less"
- } else {
- print "More"
- }
- BLOCK
- PUSHS "More"
- CALL print
- PUSHBLOCK
- PUSHW else
- BLOCK
- PUSHS "Less"
- CALL print
- PUSHBLOCK
- PUSHI 10
- PUSHW a
- CALL less
- CALL if
- }
|