How do variable names work in LLL?

nejucomonejucomo Member Posts: 40
I've just read https://github.com/ethereum/cpp-ethereum/wiki/LLL-PoC-5 and looked at examples in https://github.com/ethereum/cpp-ethereum/wiki/LLL-Examples-for-PoC-5 but I am confused about variable names. The first page says:

"""
Any otherwise undefined text strings are assumed to be variable definitions, thus a for loop to count between 0 to 9 looks something like:

(for [i]:0 (< @i 10) [i](+ @i 1)
;; do something
)
"""

The code example makes 'i' seem like an expression which is used for indexing memory. What does it evaluate to? What if I need K bytes of memory, how can I ensure I won't clobber any variables?

Two other quick questions:

Where is the compiler for LLL? I've found serpent, but not the LLL compiler.

An example shows:

"""
@(calldataload 0)
"""

What is the ':' here? It is not mentioned in the LLL-PoC-5 spec.

Best Answer

Answers

  • mode80mode80 Member Posts: 64 ✭✭
    The colon is undocumented, but it's just whitespace far as I can tell. I think it helps with readability when using the shortcut [slot]:value notation in place of (mstore slot value)
Sign In or Register to comment.