Skip to content

Latest commit

 

History

History
410 lines (253 loc) · 7.92 KB

internal.md

File metadata and controls

410 lines (253 loc) · 7.92 KB

y_functional - v1.0

Lambda functions and functional program functions - map, fold, etc.

(c) 2022 YSI contibutors, licensed under MPL 1.1

Functions

CTRL_OnCodeInit:

Syntax

CTRL_OnCodeInit()

Remarks

Initialise the system

Depends on

Attributes

  • public

Estimated stack usage

713 cells

Functional_FoundAfter:

Syntax

Functional_FoundAfter(scanner[])

Parameters

Name Info
scanner [172] The code scanner that found a match.

Remarks

Called when a scanner matches a LAM@5() call, denoting the end of the lambda call. Just removes the call and stores the location.

Depends on

Estimated stack usage

4 cells

Functional_FoundCall:

Syntax

Functional_FoundCall(scanner[], nestingLevel)

Parameters

Name Info
scanner [172] The code scanner that found a match.
nestingLevel How many lambdas deep this call is.

Remarks

Once a lambda call is found this code is called to trigger a new set of scans to analyse the lambda function itself. It then does the code generation based on the results. This is to allow nested lambdas as the calls are found first, then the second set of scans run without preventing the call scanner from finding more results later.

Depends on

Estimated stack usage

1488 cells

Functional_FoundCall1:

Syntax

Functional_FoundCall1(scanner[])

Parameters

Name Info
scanner [172] The code scanner that found a match.

Remarks

Used when a matcher finds a lambda call with an explicit nesting level.

Depends on

Estimated stack usage

6 cells

Functional_FoundCall2:

Syntax

Functional_FoundCall2(scanner[])

Parameters

Name Info
scanner [172] The code scanner that found a match.

Remarks

Used when a matcher finds a lambda call with a ZERO op for the nesting level.

Depends on

Estimated stack usage

5 cells

Functional_FoundEnd:

Syntax

Functional_FoundEnd(scanner[])

Parameters

Name Info
scanner [172] The code scanner that found a match.

Remarks

Called when a scanner matches a LAM@2() call, denoting the end of a lambda function. Just removes the call and stores the location.

Depends on

Estimated stack usage

4 cells

Functional_FoundStart:

Syntax

Functional_FoundStart(scanner[])

Parameters

Name Info
scanner [172] The code scanner that found a match.

Remarks

Called when a scanner matches a LAM@1() call, denoting the start of a lambda function. Just removes the call and stores the location.

Depends on

Estimated stack usage

4 cells

LAM@0:

Syntax

LAM@0(idx)

Parameters

Name Info
idx Used by nested lambda calls.

Remarks

Marks the point in code where the lambda function gets called.

Estimated stack usage

1 cells

LAM@1:

Syntax

LAM@1(idx, pattern0, pattern1, pattern2, pattern3)

Parameters

Name Info
idx
pattern0
pattern1
pattern2
pattern3

Remarks

Placeholder function used to deonte the start of lambda code. All parameters are dummies, used for code scanning and generation space padding.

Estimated stack usage

1 cells

LAM@2:

Syntax

LAM@2(par)

Parameters

Name Info
par

Remarks

Placeholder function used to deonte the end of lambda code. The parameter is eventually used in the rewitten code to return the result.

Estimated stack usage

1 cells

LAM@5:

Syntax

LAM@5(idx, pattern0, pattern1, pattern2, pattern3, pattern4, pattern5, pattern6)

Parameters

Name Info
idx
pattern0
pattern1
pattern2
pattern3
pattern4
pattern5
pattern6

Remarks

The end of all the generated code; functions and calls.

Estimated stack usage

1 cells