-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguide.crcl
More file actions
73 lines (53 loc) · 1.7 KB
/
guide.crcl
File metadata and controls
73 lines (53 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# This evaluates to 1, which allow the whole file to start executing
(S)
# As long as no other global circular array index starts with V there will not be a naming collision
; (V) := V_a
# Initialize ( (V) ) so that we can use this to store local variables
; ( (V) ) := ((0))
# ((Array)) -> len
; (F_len) := ((
# Assumes that `( (V) + 1*1 )` has been set to `((0))` before the function is called.
( (V) + 1*1 )
# Increment `(V)` for convenience and for recursive function call.
; (V) := (V) + 1*1
# Put all local variable on `( (V) )`.
; ( (V) )(I) := 1
# loop
; ((
( (V) )(Not_found_len)
; ( (V) )(Array)(0) := 0
; ( (V) )(Array)( ( (V) )(I) ) := 1
; ( (V) )(Not_found_len) := ( (V) )(Array)(0) != 1
; ( (V) )(I) := ( (V) )(I) + 1
))
; ( (V) )(I) := ( (V) )(I) - 1
# Use `(R)` to store return values
; (R) := ( (V) )(I)
# Set `( (V) )` to 0 to prevent the function / array to be executed again
; ( (V) ) := 0
# Decrement `(V)` to revert earlier incrementation.
; (V) := (V) - 1*1
))
# Initialized the next call stack to be `((0))` just as every function assumes.
# Without this (F_len) would not execute
; ( (V) + 1*1 ) := ((0))
# Set argument
; ( (V) + 1*1 )(Array) := ((a; r; r))
# Evaluate the array at `(F_len)` which we defined earlier
; (F_len)
# Fetch return value
; ( (V) )(Len) := (R)
# If statement
# Set `(S)` to the condition of the if statement
; (S) := ( (V) )(Len) = 3
# If `(S)` is non zero the if statement will execute
; ((
(S)
; (std_output_char) := y * 1
; (std_output)
# Prevent the array from executing again
; (S) := 0
))
# (S) = 0 no matter if the array executed or not
# To prevent the whole file from executing again
; (S) := 0