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-12 18:21:16 -05:00
|
|
|
(fn) <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-12 18:21:16 -05:00
|
|
|
Function Declaration
|
2023-12-01 22:54:25 -05:00
|
|
|
================================================================================
|
|
|
|
|
2023-12-12 18:21:16 -05:00
|
|
|
foobar = (fn x <int>, y <int>) <int> {
|
|
|
|
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-10-18 17:52:56 -04:00
|
|
|
Function Call
|
2023-10-31 15:21:13 -04:00
|
|
|
================================================================================
|
2023-10-18 17:52:56 -04:00
|
|
|
|
|
|
|
(foobar "Hiya")
|
|
|
|
|
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-02 02:34:23 -05:00
|
|
|
(expression
|
|
|
|
(identifier))
|
2023-11-10 20:44:03 -05:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))))))
|
2023-10-18 17:52:56 -04:00
|
|
|
|
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
|
|
|
|
|
|
|
(foobar
|
|
|
|
"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-02 02:34:23 -05:00
|
|
|
(expression
|
|
|
|
(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
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
x = (fn cb <() -> bool>) <bool> {
|
|
|
|
(cb)
|
|
|
|
}
|
|
|
|
|
|
|
|
(x (fn) <bool> { true })
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
|
|
|
(identifier)
|
|
|
|
(type_definition
|
|
|
|
(type
|
|
|
|
(type)))
|
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
|
|
|
(expression
|
|
|
|
(identifier))))))))))))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
|
|
|
(expression
|
|
|
|
(identifier))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(function
|
|
|
|
(type_definition
|
|
|
|
(type))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(boolean))))))))))))
|