2023-10-31 15:21:13 -04:00
|
|
|
================================================================================
|
2023-12-12 18:21:16 -05:00
|
|
|
Anonymous Function
|
2023-10-31 15:21:13 -04:00
|
|
|
================================================================================
|
2023-10-18 17:52:56 -04:00
|
|
|
|
2023-12-31 14:04:10 -05:00
|
|
|
() <str> { "Hiya" }
|
2023-10-18 17:52:56 -04:00
|
|
|
|
2023-10-31 15:21:13 -04:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 17:52:56 -04:00
|
|
|
|
|
|
|
(root
|
2023-11-10 20:44:03 -05:00
|
|
|
(statement
|
2023-12-01 22:54:25 -05:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
2023-12-12 18:21:16 -05:00
|
|
|
(type_definition
|
|
|
|
(type))
|
2023-12-01 22:54:25 -05:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))))))
|
|
|
|
|
|
|
|
================================================================================
|
2023-12-29 20:14:03 -05:00
|
|
|
Function Assignment
|
2023-12-01 22:54:25 -05:00
|
|
|
================================================================================
|
|
|
|
|
2023-12-29 20:14:03 -05:00
|
|
|
foobar = (x <int>, y <int>) <int> {
|
2023-12-12 18:21:16 -05:00
|
|
|
x + y
|
|
|
|
}
|
2023-12-01 22:54:25 -05:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(assignment
|
2023-11-10 20:44:03 -05:00
|
|
|
(identifier)
|
2023-12-01 22:54:25 -05:00
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
|
|
|
(identifier)
|
2023-12-12 18:21:16 -05:00
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(identifier)
|
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(type_definition
|
|
|
|
(type))
|
2023-12-01 22:54:25 -05:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
2023-12-12 18:21:16 -05:00
|
|
|
(math
|
|
|
|
(expression
|
|
|
|
(identifier))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(identifier)))))))))))))
|
2023-10-31 18:18:39 -04:00
|
|
|
|
2023-10-31 15:21:13 -04:00
|
|
|
================================================================================
|
2023-12-29 20:14:03 -05:00
|
|
|
Identifier Function Call
|
2023-10-31 15:21:13 -04:00
|
|
|
================================================================================
|
2023-10-18 17:52:56 -04:00
|
|
|
|
2023-12-29 20:14:03 -05:00
|
|
|
foobar("Hiya")
|
2023-10-18 17:52:56 -04:00
|
|
|
|
2023-10-31 15:21:13 -04:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 17:52:56 -04:00
|
|
|
|
|
|
|
(root
|
2023-11-10 20:44:03 -05:00
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 18:59:15 -05:00
|
|
|
(function_expression
|
2023-12-02 02:34:23 -05:00
|
|
|
(identifier))
|
2023-11-10 20:44:03 -05:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))))))
|
2023-10-18 17:52:56 -04:00
|
|
|
|
2023-12-29 19:22:41 -05:00
|
|
|
================================================================================
|
2023-12-29 20:14:03 -05:00
|
|
|
Index Function Call
|
2023-12-29 19:22:41 -05:00
|
|
|
================================================================================
|
|
|
|
|
2023-12-29 20:14:03 -05:00
|
|
|
foo:bar("Hiya")
|
2023-12-29 19:22:41 -05:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
2023-12-31 23:38:09 -05:00
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(index
|
|
|
|
(index_expression
|
2023-12-29 19:22:41 -05:00
|
|
|
(identifier))
|
2023-12-31 23:38:09 -05:00
|
|
|
(index_expression
|
|
|
|
(identifier))))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))))))
|
2023-12-29 20:14:03 -05:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Double Function Call
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
foobar()("Hiya")
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
2023-12-29 19:22:41 -05:00
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(identifier))))
|
|
|
|
(expression
|
|
|
|
(value
|
2023-12-29 20:14:03 -05:00
|
|
|
(string)))))))
|
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Anonymous Function Call
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
(msg <str>) <str> { msg } ("Hiya");
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
2023-12-29 19:22:41 -05:00
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
2024-01-01 04:59:27 -05:00
|
|
|
(value
|
|
|
|
(function
|
|
|
|
(identifier)
|
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(identifier)))))))
|
2023-12-29 19:22:41 -05:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))))))
|
|
|
|
|
2023-10-31 15:21:13 -04:00
|
|
|
================================================================================
|
2023-10-18 17:52:56 -04:00
|
|
|
Complex Function Call
|
2023-10-31 15:21:13 -04:00
|
|
|
================================================================================
|
2023-10-18 17:52:56 -04:00
|
|
|
|
2023-12-29 20:14:03 -05:00
|
|
|
foobar(
|
2023-10-18 17:52:56 -04:00
|
|
|
"hi"
|
|
|
|
42
|
2023-11-28 11:01:38 -05:00
|
|
|
{
|
2023-10-18 17:52:56 -04:00
|
|
|
x = 1
|
|
|
|
y = 2
|
2023-11-28 11:01:38 -05:00
|
|
|
}
|
2023-10-18 17:52:56 -04:00
|
|
|
)
|
|
|
|
|
2023-10-31 15:21:13 -04:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 17:52:56 -04:00
|
|
|
|
|
|
|
(root
|
2023-11-10 20:44:03 -05:00
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 18:59:15 -05:00
|
|
|
(function_expression
|
2023-12-02 02:34:23 -05:00
|
|
|
(identifier))
|
2023-11-10 20:44:03 -05:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(map
|
|
|
|
(identifier)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))
|
|
|
|
(identifier)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))))))))
|
2023-12-15 17:27:29 -05:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Callback Function Call
|
|
|
|
================================================================================
|
|
|
|
|
2023-12-29 20:14:03 -05:00
|
|
|
x(() <bool> { true })
|
2023-12-15 17:27:29 -05:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 18:59:15 -05:00
|
|
|
(function_expression
|
2023-12-15 17:27:29 -05:00
|
|
|
(identifier))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(boolean))))))))))))
|
2023-12-16 21:15:36 -05:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Nested Function Call
|
|
|
|
================================================================================
|
|
|
|
|
2023-12-29 20:14:03 -05:00
|
|
|
from_json(read('file.json'))
|
2023-12-16 21:15:36 -05:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 18:59:15 -05:00
|
|
|
(function_expression
|
2024-01-01 04:59:27 -05:00
|
|
|
(identifier))
|
2023-12-16 21:15:36 -05:00
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 18:59:15 -05:00
|
|
|
(function_expression
|
2024-01-01 04:59:27 -05:00
|
|
|
(identifier))
|
2023-12-16 21:15:36 -05:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))))))))
|