Initial commit: Add README and LICENSE
This commit is contained in:
36
corpus/basic.txt
Normal file
36
corpus/basic.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
==================
|
||||
Basic Command
|
||||
==================
|
||||
var x = 1
|
||||
------------------
|
||||
(source_file
|
||||
(command
|
||||
(identifier)
|
||||
(binary_expression
|
||||
(identifier)
|
||||
(number)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
Conditional
|
||||
==================
|
||||
? x > 0
|
||||
print "Hello"
|
||||
|
||||
------------------
|
||||
(source_file
|
||||
(conditional
|
||||
(binary_expression
|
||||
(identifier)
|
||||
(number)
|
||||
)
|
||||
(block
|
||||
(command
|
||||
(identifier)
|
||||
(string)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
337
corpus/stonescript.txt
Normal file
337
corpus/stonescript.txt
Normal file
@@ -0,0 +1,337 @@
|
||||
==================
|
||||
Variable Declarations
|
||||
==================
|
||||
var x
|
||||
var y = 10
|
||||
var name = "Hello"
|
||||
var flag = true
|
||||
------------------
|
||||
(source_file
|
||||
(variable_declaration (identifier))
|
||||
(variable_declaration (identifier) (number))
|
||||
(variable_declaration (identifier) (string))
|
||||
(variable_declaration (identifier) (boolean))
|
||||
)
|
||||
|
||||
==================
|
||||
Function Declaration
|
||||
==================
|
||||
func test()
|
||||
return 5
|
||||
|
||||
func add(a, b)
|
||||
return a + b
|
||||
------------------
|
||||
(source_file
|
||||
(function_declaration
|
||||
(identifier)
|
||||
(block
|
||||
(return_statement (number))
|
||||
)
|
||||
)
|
||||
(function_declaration
|
||||
(identifier)
|
||||
(parameter_list (identifier) (identifier))
|
||||
(block
|
||||
(return_statement
|
||||
(binary_expression (identifier) (identifier))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
For Loops
|
||||
==================
|
||||
for i = 1..10
|
||||
var x = i
|
||||
|
||||
for item : array
|
||||
print item
|
||||
------------------
|
||||
(source_file
|
||||
(for_loop
|
||||
(identifier)
|
||||
(number)
|
||||
(number)
|
||||
(block
|
||||
(variable_declaration (identifier) (identifier))
|
||||
)
|
||||
)
|
||||
(for_loop
|
||||
(identifier)
|
||||
(identifier)
|
||||
(block
|
||||
(command (identifier) (identifier))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
Arrays
|
||||
==================
|
||||
var arr = []
|
||||
var nums = [1, 2, 3]
|
||||
var names = ["a", "b"]
|
||||
------------------
|
||||
(source_file
|
||||
(variable_declaration (identifier) (array))
|
||||
(variable_declaration (identifier) (array (array_elements (number) (number) (number))))
|
||||
(variable_declaration (identifier) (array (array_elements (string) (string))))
|
||||
)
|
||||
|
||||
==================
|
||||
Member Access and Method Calls
|
||||
==================
|
||||
var x = loc.stars
|
||||
var y = math.Sqrt(9)
|
||||
arr.Add(5)
|
||||
------------------
|
||||
(source_file
|
||||
(variable_declaration
|
||||
(identifier)
|
||||
(member_expression (identifier) (identifier))
|
||||
)
|
||||
(variable_declaration
|
||||
(identifier)
|
||||
(call_expression
|
||||
(member_expression (identifier) (identifier))
|
||||
(argument_list (number))
|
||||
)
|
||||
)
|
||||
(expression_statement
|
||||
(call_expression
|
||||
(member_expression (identifier) (identifier))
|
||||
(argument_list (number))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
Conditionals with Else
|
||||
==================
|
||||
?hp < 10
|
||||
activate potion
|
||||
:?hp < 20
|
||||
equip shield
|
||||
:
|
||||
equip sword
|
||||
------------------
|
||||
(source_file
|
||||
(conditional
|
||||
(binary_expression (identifier) (number))
|
||||
(block
|
||||
(command (identifier) (identifier))
|
||||
)
|
||||
)
|
||||
(else_clause
|
||||
(binary_expression (identifier) (number))
|
||||
(block
|
||||
(command (identifier) (identifier))
|
||||
)
|
||||
)
|
||||
(else_clause
|
||||
(block
|
||||
(command (identifier) (identifier))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
Equipment Commands
|
||||
==================
|
||||
equip sword
|
||||
equipL poison wand
|
||||
equipR vigor shield *7 +5
|
||||
------------------
|
||||
(source_file
|
||||
(command (identifier))
|
||||
(command (identifier) (identifier))
|
||||
(command (identifier) (identifier) (identifier) (number) (number))
|
||||
)
|
||||
|
||||
==================
|
||||
Activate and Loadout
|
||||
==================
|
||||
activate potion
|
||||
activate R
|
||||
loadout 1
|
||||
------------------
|
||||
(source_file
|
||||
(command (identifier))
|
||||
(command (identifier))
|
||||
(command (number))
|
||||
)
|
||||
|
||||
==================
|
||||
Import and New
|
||||
==================
|
||||
import UI/MindstoneButton
|
||||
var obj = new Components/Vector
|
||||
------------------
|
||||
(source_file
|
||||
(import_statement (module_path))
|
||||
(variable_declaration
|
||||
(identifier)
|
||||
(new_statement (module_path))
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
Binary Operations
|
||||
==================
|
||||
var result = a + b * c
|
||||
var check = x > 5 & y < 10
|
||||
------------------
|
||||
(source_file
|
||||
(variable_declaration
|
||||
(identifier)
|
||||
(binary_expression
|
||||
(identifier)
|
||||
(binary_expression (identifier) (identifier))
|
||||
)
|
||||
)
|
||||
(variable_declaration
|
||||
(identifier)
|
||||
(binary_expression
|
||||
(binary_expression (identifier) (number))
|
||||
(binary_expression (identifier) (number))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
Update Expressions
|
||||
==================
|
||||
i++
|
||||
--j
|
||||
var x = count++
|
||||
------------------
|
||||
(source_file
|
||||
(expression_statement (update_expression (identifier)))
|
||||
(expression_statement (update_expression (identifier)))
|
||||
(variable_declaration (identifier) (update_expression (identifier)))
|
||||
)
|
||||
|
||||
==================
|
||||
Assignment Operations
|
||||
==================
|
||||
x += 5
|
||||
y *= 2
|
||||
count -= 1
|
||||
------------------
|
||||
(source_file
|
||||
(expression_statement (assignment_expression (identifier) (number)))
|
||||
(expression_statement (assignment_expression (identifier) (number)))
|
||||
(expression_statement (assignment_expression (identifier) (number)))
|
||||
)
|
||||
|
||||
==================
|
||||
Return, Break, Continue
|
||||
==================
|
||||
func test()
|
||||
for i = 1..10
|
||||
?i = 5
|
||||
break
|
||||
?i = 3
|
||||
continue
|
||||
return i
|
||||
------------------
|
||||
(source_file
|
||||
(function_declaration
|
||||
(identifier)
|
||||
(block
|
||||
(for_loop
|
||||
(identifier)
|
||||
(number)
|
||||
(number)
|
||||
(block
|
||||
(conditional
|
||||
(binary_expression (identifier) (number))
|
||||
(block (break_statement))
|
||||
)
|
||||
(conditional
|
||||
(binary_expression (identifier) (number))
|
||||
(block (continue_statement))
|
||||
)
|
||||
)
|
||||
)
|
||||
(return_statement (identifier))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
==================
|
||||
Comments
|
||||
==================
|
||||
// Single line comment
|
||||
var x = 5 // inline comment
|
||||
/* Block
|
||||
comment */
|
||||
var y = 10
|
||||
------------------
|
||||
(source_file
|
||||
(comment)
|
||||
(variable_declaration (identifier) (number))
|
||||
(comment)
|
||||
(block_comment)
|
||||
(variable_declaration (identifier) (number))
|
||||
)
|
||||
|
||||
==================
|
||||
Real Example from Manual
|
||||
==================
|
||||
?loc=rocky
|
||||
equip shovel
|
||||
?loc=cave
|
||||
loadout 1
|
||||
?foe=bolesh
|
||||
equip grap
|
||||
equip hammer *7
|
||||
?loc=halls
|
||||
equipL poison wand
|
||||
equipR vigor wand
|
||||
?loc.stars > 5
|
||||
equip vigor staff +13
|
||||
?hp < 10
|
||||
activate potion
|
||||
------------------
|
||||
(source_file
|
||||
(conditional
|
||||
(binary_expression (identifier) (identifier))
|
||||
(block (command (identifier)))
|
||||
)
|
||||
(conditional
|
||||
(binary_expression (identifier) (identifier))
|
||||
(block
|
||||
(command (number))
|
||||
(conditional
|
||||
(binary_expression (identifier) (identifier))
|
||||
(block
|
||||
(command (identifier))
|
||||
(command (identifier) (identifier) (number))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(conditional
|
||||
(binary_expression (identifier) (identifier))
|
||||
(block
|
||||
(command (identifier) (identifier))
|
||||
(command (identifier) (identifier))
|
||||
(conditional
|
||||
(binary_expression
|
||||
(member_expression (identifier) (identifier))
|
||||
(number)
|
||||
)
|
||||
(block
|
||||
(command (identifier) (identifier) (identifier) (number))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(conditional
|
||||
(binary_expression (identifier) (number))
|
||||
(block (command (identifier)))
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user