123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- SELSL is a Simple English Like Scripting Language
- It is implemented in Go language for use with Go muds, such as my Woe
- MUD engine. It is indended to be usable both as an interective command
- interpreter for the users of the MUD as well as a scripting language
- for the builders.
- While the goal is to be english like, a second goal is to be simple,
- so it does not use any advanced AI like techniques to parse the
- input. Rarther it uses a few simple rules to reduce the user input to
- commands, and blocks of commands.
- he
- him
- his
- she
- her
- hers
- they
- them
- their
- theirs
- it
- its
- me
- myself
- i
- SELSL is object oriented but not class based. In stead it is prototype
- based much like the SELF language. In SELSL, everything is an object.
- Objects have slots that can contain other values. There are basic objects
- which evaluate to themselves, and excutable objects which perform
- some computation to produce their result.
- An object also has an effect on computation. Normal objects have no effect,
- but a Return causes the block to end execution early. A Throw
- will keep on unless if it is stopped with a Catch.
- Variables, and also arguments are simply slots of the current activation
- record of an executable object. There are no stand alone variables.
- Eveything exists in something else, except for the top level "world".
- There is also a "me" object which represents the the current actor
- that is operating on the state of the world.
- A SELSL script consists of commands. Commands operate on the state of the
- world and may cause output to be produced as well.
- A command begins with a verb and is optionally followed by the objects the
- command perates on. If a command has no objects it will operate on the
- "me" object. Commands are separated from each other by one of
- the English prepositions or conjunctions that SELSL accepts. See below for
- the lists. Commands are also separated by the particles "a", "an", "the",
- or the demonstratives "this", "that", "those".
- A command is ended by a period. A column in a command announces the start of a
- block. The command end ends a block.
- Teach an actor to open a door do
- Check if door's open then
- Set door's open to false.
- Tell an actor to: Format "You close the %s" with door's name;
- else do
- Tell an actor to: Format "The %s is already closed" with door's name;
- end of check.
- End of teach.
- Set hp of me as add 1 with divide hp of me by 2 end end
- Create a red door as a door.
- open red door with green key
- cast cure light at smart bob
- (This is (nestable)
- multi line comment)
- # This is single line comment for compatibility with shell scripts.
- end of command with `.` or newline
- start of block with `:`, do.
- end of block with 'end', ';', ''
- Syntactic sugar: `as` and `with` are translated to `to do`
- SCRIPT -> COMMAND eoc EOC SCRIPT | .
- EOC -> eoc EOC | .
- COMMAND -> word EXPRESSIONS .
- EXPRESSIONS -> EXPRESSION separator EXPRESSIONS | .
- EXPRESSION -> OBJECT | number | BLOCK.
- OBJECT-> word ATTRIBUTES .
- ATTRIBUTES -> OFS EXPRESSION | .
- OFS -> of | s .
- BLOCK -> ob SCRIPT END .
- END -> end COMMAND .
- Including queries:
- SCRIPT -> COMMAND eoc EOC SCRIPT | .
- EOC -> eoc EOC | .
- COMMAND -> word EXPRESSIONS .
- EXPRESSIONS -> EXPRESSION separator EXPRESSIONS | .
- EXPRESSION -> OBJECT | number | BLOCK | QUERY .
- QUERY -> ISQUERY | QWQUERY.
- ISQUERY -> is EXPRESSION qm .
- QWQUERY -> qw EXPRESSION qm .
- OBJECT-> word ATTRIBUTES .
- ATTRIBUTES -> OFS EXPRESSION | .
- OFS -> of | s .
- BLOCK -> ob SCRIPT END .
- END -> end COMMAND .
- Conjunction List
- After
- Although
- As
- Because
- Before
- Even
- If
- Inasmuch
- Lest
- Now
- Once
- Provided
- Rather
- Since
- So
- Supposing
- Than
- That
- Though
- Till
- Unless
- Until
- When
- Whenever
- Where
- Whereas
- Wherever
- Whether
- Which
- While
- Who
- Whoever
- Why
- Preposition List.
- about
- aboard
- above
- across
- after
- against
- along
- amid
- among
- around
- as
- at
- before
- behind
- below
- beneath
- beside
- between
- beyond
- but
- by
- concerning
- considering
- despite
- down
- during
- except
- following
- for
- from
- in
- inside
- into
- like
- minus
- near
- next
- of
- off
- on
- onto
- opposite
- out
- outside
- over
- past
- per
- plus
- regarding
- round
- save
- since
- than
- through
- till
- to
- toward
- under
- underneath
- unlike
- until
- up
- upon
- versus
- via
- with
- within
- without
|