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
|
2023-12-02 03:54:25 +00:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
2024-01-23 19:35:57 +00:00
|
|
|
(type_specification
|
2023-12-12 23:21:16 +00:00
|
|
|
(type))
|
2023-12-02 03:54:25 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))))))
|
|
|
|
|
|
|
|
================================================================================
|
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
|
|
|
|
(assignment
|
2023-11-11 01:44:03 +00:00
|
|
|
(identifier)
|
2023-12-02 03:54:25 +00:00
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
|
|
|
(identifier)
|
2024-01-23 19:35:57 +00:00
|
|
|
(type_specification
|
2023-12-12 23:21:16 +00:00
|
|
|
(type))
|
|
|
|
(identifier)
|
2024-01-23 19:35:57 +00:00
|
|
|
(type_specification
|
2023-12-12 23:21:16 +00:00
|
|
|
(type))
|
2024-01-23 19:35:57 +00:00
|
|
|
(type_specification
|
2023-12-12 23:21:16 +00:00
|
|
|
(type))
|
2023-12-02 03:54:25 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
2023-12-12 23:21:16 +00:00
|
|
|
(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
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2023-12-02 07:34:23 +00:00
|
|
|
(identifier))
|
2023-11-11 01:44:03 +00:00
|
|
|
(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
|
|
|
|
(expression
|
2024-01-01 04:38:09 +00:00
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(index
|
|
|
|
(index_expression
|
2023-12-30 00:22:41 +00:00
|
|
|
(identifier))
|
2024-01-01 04:38:09 +00:00
|
|
|
(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
|
|
|
|
(expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(identifier))))
|
|
|
|
(expression
|
|
|
|
(value
|
2023-12-30 01:14:03 +00:00
|
|
|
(string)))))))
|
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Anonymous Function Call
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
(msg <str>) <str> { msg } ("Hiya");
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
2023-12-30 00:22:41 +00:00
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
2024-01-01 09:59:27 +00:00
|
|
|
(value
|
|
|
|
(function
|
|
|
|
(identifier)
|
2024-01-23 19:35:57 +00:00
|
|
|
(type_specification
|
2024-01-01 09:59:27 +00:00
|
|
|
(type))
|
2024-01-23 19:35:57 +00:00
|
|
|
(type_specification
|
2024-01-01 09:59:27 +00:00
|
|
|
(type))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(identifier)))))))
|
2023-12-30 00:22:41 +00:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))))))
|
|
|
|
|
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
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2023-12-02 07:34:23 +00:00
|
|
|
(identifier))
|
2023-11-11 01:44:03 +00:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(map
|
|
|
|
(identifier)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))
|
|
|
|
(identifier)
|
|
|
|
(statement
|
|
|
|
(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
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2023-12-15 22:27:29 +00:00
|
|
|
(identifier))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
2024-01-23 19:35:57 +00:00
|
|
|
(type_specification
|
2023-12-15 22:27:29 +00:00
|
|
|
(type))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(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
|
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2024-01-01 09:59:27 +00:00
|
|
|
(identifier))
|
2023-12-17 02:15:36 +00:00
|
|
|
(expression
|
|
|
|
(function_call
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2024-01-01 09:59:27 +00:00
|
|
|
(identifier))
|
2023-12-17 02:15:36 +00:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))))))))
|