avdl.texi 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. \input texinfo @c -*-texinfo-*-
  2. @comment $Id@w{$}
  3. @comment %**start of header
  4. @settitle avdl 1.0
  5. @syncodeindex pg cp
  6. @comment %**end of header
  7. @titlepage
  8. @title avdl
  9. @subtitle for version 1.0
  10. @author Tom Tsagk (@email{tomtsagk@@gmail.com})
  11. @page
  12. @vskip 0pt plus 1filll
  13. @end titlepage
  14. @contents
  15. @ifnottex
  16. @node Top
  17. @top avdl
  18. This manual is for avdl (version 1.0).
  19. @end ifnottex
  20. @menu
  21. * Introduction::
  22. * Keywords::
  23. @end menu
  24. @node Introduction
  25. @chapter Introduction
  26. @code{avdl} is a lisp-like programming language for making video games.
  27. Its syntax and keywords are meant to describe a game in an abstract way, which then the compiler
  28. can translate to specific platforms.
  29. @node Keywords
  30. @chapter Keywords
  31. @c command - echo
  32. @section echo
  33. @code{(echo arg0 arg1 .. argN)}
  34. Prints all arguments to standard output.
  35. Combines arguments together.
  36. The arguments can be one of the following types:
  37. @code{string}, @code{int}, @code{float}
  38. Example:
  39. @example
  40. (echo "The result is " my_var)
  41. @end example
  42. Assuming the variable @code{my_var} is 5, this will produce:
  43. @example
  44. The result is 5
  45. @end example
  46. @c command - def
  47. @section def
  48. @code{(def type name [value])}
  49. This defines a variable with the given @code{type} and @code{name}.
  50. @code{type} can be one of the following values:
  51. @itemize @bullet
  52. @c@item @code{string} to declare a string (any set of characters surrounded by quotes),
  53. @item @code{int} to declare integers,
  54. @item @code{float} to declare floating numbers.
  55. @end itemize
  56. @code{name} has to start with a letter (@code{[a-zA-Z]}),
  57. followed by any number of either letters (@code{[a-zA-Z]}),
  58. numbers (@code{[0-9]}), or an underscore (@code{_}).
  59. Optionally a @code{value} can be passed, to initialise the variable with.
  60. @code{value} should have the same type as @code{type}.
  61. Examples:
  62. @example
  63. (def int x)
  64. @end example
  65. This defines a variable @code{x} with type @code{int}.
  66. @example
  67. (def float y 0.5)
  68. @end example
  69. This defines a variable @code{y} with type @code{float} and initialised with the value @code{0.5}.
  70. @c binary operators
  71. @section Binary Operators
  72. @subsection =
  73. @code{(= var_name value)}
  74. Assigns @code{value} to the variable @code{var_name}. Example:
  75. @example
  76. (= x 5)
  77. @end example
  78. Assigns the value @code{5} to the variable @code{x}.
  79. @subsection +
  80. @code{(+ arg0 arg1 .. argN)}
  81. Adds all arguments together, and returns the result.
  82. @subsection -
  83. @code{(- arg0 arg1 .. argN)}
  84. Substracts all arguments together, and returns the result.
  85. @subsection *
  86. @code{(* arg0 arg1 .. argN)}
  87. Multiplies all arguments together, and returns the result.
  88. @subsection /
  89. @code{(/ arg0 arg1 .. argN)}
  90. Divines all arguments together, and returns the result.
  91. @subsection >=
  92. @code{(>= arg0 arg1 .. argN)}
  93. Compares all arguments left-to-right, and returns the result.
  94. @subsection ==
  95. @code{(== arg0 arg1 .. argN)}
  96. Compares all arguments left-to-right, and returns the result.
  97. @subsection <=
  98. @code{(<= arg0 arg1 .. argN)}
  99. Compares all arguments left-to-right, and returns the result.
  100. @subsection <
  101. @code{(< arg0 arg1 .. argN)}
  102. Compares all arguments left-to-right, and returns the result.
  103. @subsection >
  104. @code{(> arg0 arg1 .. argN)}
  105. Compares all arguments left-to-right, and returns the result.
  106. @subsection &&
  107. @code{(&& arg0 arg1 .. argN)}
  108. Returns @code{true} if all arguments are @code{true}, otherwise @code{false}.
  109. @subsection ||
  110. @code{(|| arg0 arg1 .. argN)}
  111. Returns @code{true} if any of the arguments are @code{true}, otherwise @code{false}.
  112. @c command group
  113. @section group
  114. @code{(group arg0 arg1 .. argN)}
  115. Groups commands together, useful to pass multiple commands when another command expects only one.
  116. @c command function
  117. @section function
  118. @code{(function name arguments command)}
  119. Declare a function called @code{name}, that expects the given @code{arguments}
  120. (Arguments are not yet implemented, for now they expect to be an empty group).
  121. When the function is called, it executes the given @code{command}.
  122. @code{command} can either be a single command or a @code{group} of commands.
  123. Example:
  124. @example
  125. (function print_hello_world (group)
  126. (echo "hello world")
  127. )
  128. @end example
  129. This creates a function with name @code{print_hello_world}, takes no arguments (@code{(group)} is an empty group),
  130. and when called runs the command @code{(echo "hello world")}.
  131. New functions are called like a build-in command. For the example above, the function can be called with this:
  132. @example
  133. (print_hello_world)
  134. @end example
  135. @c command if
  136. @section if
  137. @code{(if cond1 stmt1 cond2 stmt2 .. [condN] stmtN)}
  138. For every 2 arguments, check if the condition (@code{cond1}) is true, then execute its statements (@code{stm1}).
  139. If there is an odd number of children, the last statement will trigger if no other statement has.
  140. @c command class
  141. @section class
  142. @code{(class name [subclass] data)}
  143. Declare a class called @code{name}, optionally a subclass of @code{subclass}
  144. and contains @code{data} (variables and functions).
  145. @c command new
  146. @section new
  147. @code{(new class_name)}
  148. Create a new instance of a class named @code{class_name}, and return its value.
  149. @c command sprite
  150. @section sprite
  151. @code{(sprite name filename)}
  152. Create a sprite called @code{name} with texture @code{filename}
  153. @c command return
  154. @section return
  155. @code{(return val)}
  156. Return the value @code{val} from a function.
  157. @c command array
  158. @section array
  159. @code{(array arg0 arg1 .. argN)}
  160. Creates an array containing all arguments.
  161. @printindex cp
  162. @bye