Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //<LUPESYNTAX version="1.0"/>
- //Last updated: 19/04/14
- //--BUILT-IN TYPES
- //int Integer
- //char Character
- //string String (of characters)/text
- //bool Boolean /on/off true/false
- //--COMPILER INSTRUCTIONS a.k.a Pre-processor Directives -denoted by preceding "#"
- //'#auto'
- //Put in front of declarations, functions, classes etc., and if they aren't
- //being used in the program, they'll not be compiled
- //'#skip'
- //Can be used to skip compilation (inclusion) of declared element for debugging/
- //quick testing etc. (compiler ignores it)
- //'#use'
- //Includes a code file with the current code (adds it in)
- //e.g. >>use "other_code.lupe"
- //--KEYWORD MODIFIERS
- //'active'
- //Modifier: modifies the function to make it an 'active' function i.e. it
- returns something e.g. active int add(...)...{..return ? ..}...
- //'readonly' Only allows data to be read from it
- //'writeonly' Only allows something to be written to it
- //--MAIN KEYWORDS
- //'func'
- // Function, does not return a value unless preceeded with modifier 'active'.
- //Otherwise, just does job,or works with data
- //--PARSE TAG MODIFIERS
- //¬NOT: (not), before syntax word e.g. "¬NOT:12"
- //* any number (none, one, or more than one), after syntax word e.g. <word>*
- //+ one or more, after syntax word
- //--PARSE TAGS [note: '|' meaning or/alternatively]
- <obrkt> := {
- <cbrkt> := }
- //OPERATORS
- //between two operands
- <op_equ> := =
- <op_add> := +
- <op_sub> := -
- <op_mul> := *
- <op_div> := / | \
- <op> := <op_equ> | <op_add> | <op_sub> | <op_mul> | <op_div>
- //SPECIAL OPERATORS
- //between two operands (will yield result, will not affect either operand)
- <op_cnv> := >>
- //after first/only operand
- <op_inc> := ++
- <op_dec> := --
- <letter> := a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z
- | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
- <digit> := 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
- <int> := <digit>+
- <non_quote_char> := ¬NOT:"
- <char> := <non_quote_char>
- <string> := "<char>*"
- <comment> := // <char>*
- <bool> := true | false | 1 | 0
- <type> := <int> | <string> | <char> | <bool>
- <identifier_first_char> := <letter> | _
- <identifier_rest> := <letter> | <digit> | _
- <identifier> := <identifier_first_char> <identifier_rest>*
- <expression> := <string>
- | <int>
- | <arith_expression>
- | <identifier>
- | <expression> <op> <expression>
- <var_decl> := <type> <identifier> ;
- | <type> <identifier> <op_equ> <expression> ;
- | <type> <identifier> , <identifier> ;
- | <type> <identifier> , <identifier> <op_equ> <expression> ;
- | readonly <type> <identifier> , <identifier> <op_equ> <expression> ;
- | writeonly <type> <identifier> , <identifier> <op_equ> <expression> ;
- | private <var_decl>
- | public <var_decl>
- <statement> := <variable_decl>
- | <identifier> <op_equ> <expression> ;
- | call <identifier> ( <expression>* ) ;
- | <identifier> <op_cnv> <type> ;
- | print <expression>
- | <op_cnv> <expression> , <type> ;
- | <conditional>
- | <statement> ; <statement>
- <conditional> := if <expression> <op_equ> <expression> <obrkt> <statement> <cbrkt>
- | if <expression> <obrkt> <statement> <cbrkt>
- | for <expression> to <expression> <obrkt> <statement> <cbrkt>
- | for <expression> in <expression> <obrkt> <statement> <cbrkt>
- <exmpty_ret> := return ;
- <return> := return <expression> ;
- <function_decl> := func <identifier> ( <var_decl>* ) <obrkt> <exmpty_ret>* <statement> <exmpty_ret>* <cbrkt>
- | active <type> <identifier> ( <var_decl>* ) <obrkt> <statement>* <return> <statement>* <cbrkt>
- <any_decl> := <func_decl> | <var_decl>
- <class_decl> := class <identifier> <obrkt> <any_decl>* <cbrkt>
Advertisement
Add Comment
Please, Sign In to add comment