Lexical Rules

  • Integer: 64 bit with signed integer, for example:

3 345 0xff 0xBEBADA

  • Float: 64-bit float number, for example:

3.0 3.1416 314.16e-2 0.31416E1 34e1

0x0.1E 0xA23p-4 0X1.921FB54442D18P+1

  • Variable name: start with a letter or underline, letters or underscores or Numbers are acceptable, but cannot be a keyword symbol
  • String: inline string can be surrounded with two single quotes or double quotation marks, some of which can use the backslash ‘’ for escaping special characters, multi-line or inline strings can be surrounded with ‘[[‘ and ‘]]’.

Examples:

a = 'alo\n123"'
a = "alo\n123\""
a = '\97lo\10\04923"'
a = [[alo
123"]]
a = [==[
alo
123"]==]
  • Keyword:
and       break     do        else      elseif    end
false     for       function  goto      if        in
local     nil       not       or        repeat    return
then      true      until     while    offline
  • true/false/nil literal notation
  • Punctuation mark:
+     -     *     /     %     ^     #
&     ~     |     <<    >>    //
==    ~=    <=    >=    <     >     =
(     )     {     }     [     ]     ::
;     :     ,     .     ..    ...