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