README 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. SELSL is a Simple English Like Scripting Language
  2. It is implemented in Go language for use with Go muds, such as my Woe
  3. MUD engine. It is indended to be usable both as an interective command
  4. interpreter for the users of the MUD as well as a scripting language
  5. for the builders.
  6. While the goal is to be english like, a second goal is to be simple,
  7. so it does not use any advanced AI like techniques to parse the
  8. input. Rarther it uses a few simple rules to reduce the user input to
  9. commands, and blocks of commands.
  10. he
  11. him
  12. his
  13. she
  14. her
  15. hers
  16. they
  17. them
  18. their
  19. theirs
  20. it
  21. its
  22. me
  23. myself
  24. i
  25. SELSL is object oriented but not class based. In stead it is prototype
  26. based much like the SELF language. In SELSL, everything is an object.
  27. Objects have slots that can contain other values. There are basic objects
  28. which evaluate to themselves, and excutable objects which perform
  29. some computation to produce their result.
  30. An object also has an effect on computation. Normal objects have no effect,
  31. but a Return causes the block to end execution early. A Throw
  32. will keep on unless if it is stopped with a Catch.
  33. Variables, and also arguments are simply slots of the current activation
  34. record of an executable object. There are no stand alone variables.
  35. Eveything exists in something else, except for the top level "world".
  36. There is also a "me" object which represents the the current actor
  37. that is operating on the state of the world.
  38. A SELSL script consists of commands. Commands operate on the state of the
  39. world and may cause output to be produced as well.
  40. A command begins with a verb and is optionally followed by the objects the
  41. command perates on. If a command has no objects it will operate on the
  42. "me" object. Commands are separated from each other by one of
  43. the English prepositions or conjunctions that SELSL accepts. See below for
  44. the lists. Commands are also separated by the particles "a", "an", "the",
  45. or the demonstratives "this", "that", "those".
  46. A command is ended by a period. A column in a command announces the start of a
  47. block. The command end ends a block.
  48. Teach an actor to open a door do
  49. Check if door's open then
  50. Set door's open to false.
  51. Tell an actor to: Format "You close the %s" with door's name;
  52. else do
  53. Tell an actor to: Format "The %s is already closed" with door's name;
  54. end of check.
  55. End of teach.
  56. Set hp of me as add 1 with divide hp of me by 2 end end
  57. Create a red door as a door.
  58. open red door with green key
  59. cast cure light at smart bob
  60. (This is
  61. multi line comment)
  62. # This is single line comment for compatibility with shell scripts.
  63. end of command with `.` or newline
  64. start of block with `:`, do.
  65. end of block with 'end', ';', ''
  66. Syntactic sugar: `as` and `with` are translated to `to do`
  67. SCRIPT -> COMMAND eoc EOC SCRIPT | .
  68. EOC -> eoc EOC | .
  69. COMMAND -> word EXPRESSIONS .
  70. EXPRESSIONS -> EXPRESSION separator EXPRESSIONS | .
  71. EXPRESSION -> OBJECT | number | BLOCK.
  72. OBJECT-> word ATTRIBUTES .
  73. ATTRIBUTES -> OFS EXPRESSION | .
  74. OFS -> of | s .
  75. BLOCK -> ob SCRIPT END .
  76. END -> end COMMAND .
  77. Including queries:
  78. SCRIPT -> COMMAND eoc EOC SCRIPT | .
  79. EOC -> eoc EOC | .
  80. COMMAND -> word EXPRESSIONS .
  81. EXPRESSIONS -> EXPRESSION separator EXPRESSIONS | .
  82. EXPRESSION -> OBJECT | number | BLOCK | QUERY .
  83. QUERY -> ISQUERY | QWQUERY.
  84. ISQUERY -> is EXPRESSION qm .
  85. QWQUERY -> qw EXPRESSION qm .
  86. OBJECT-> word ATTRIBUTES .
  87. ATTRIBUTES -> OFS EXPRESSION | .
  88. OFS -> of | s .
  89. BLOCK -> ob SCRIPT END .
  90. END -> end COMMAND .
  91. Conjunction List
  92. After
  93. Although
  94. As
  95. Because
  96. Before
  97. Even
  98. If
  99. Inasmuch
  100. Lest
  101. Now
  102. Once
  103. Provided
  104. Rather
  105. Since
  106. So
  107. Supposing
  108. Than
  109. That
  110. Though
  111. Till
  112. Unless
  113. Until
  114. When
  115. Whenever
  116. Where
  117. Whereas
  118. Wherever
  119. Whether
  120. Which
  121. While
  122. Who
  123. Whoever
  124. Why
  125. Preposition List.
  126. about
  127. aboard
  128. above
  129. across
  130. after
  131. against
  132. along
  133. amid
  134. among
  135. around
  136. as
  137. at
  138. before
  139. behind
  140. below
  141. beneath
  142. beside
  143. between
  144. beyond
  145. but
  146. by
  147. concerning
  148. considering
  149. despite
  150. down
  151. during
  152. except
  153. following
  154. for
  155. from
  156. in
  157. inside
  158. into
  159. like
  160. minus
  161. near
  162. next
  163. of
  164. off
  165. on
  166. onto
  167. opposite
  168. out
  169. outside
  170. over
  171. past
  172. per
  173. plus
  174. regarding
  175. round
  176. save
  177. since
  178. than
  179. through
  180. till
  181. to
  182. toward
  183. under
  184. underneath
  185. unlike
  186. until
  187. up
  188. upon
  189. versus
  190. via
  191. with
  192. within
  193. without