Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOR loop does not accept compound addition in increment section #491

Open
mlongval opened this issue May 15, 2023 · 0 comments
Open

FOR loop does not accept compound addition in increment section #491

mlongval opened this issue May 15, 2023 · 0 comments

Comments

@mlongval
Copy link

I think I have found a little bug in the increment section of the FOR loop.
This code works fine:

#!/usr/bin/env abs
# the first 100 terms of the fibonnaci sequence

t1 = 0      # first term
t2 = 1      # second term

max = 100   # max number of iterations

echo(t1)
echo(t2)

for counter = 0; counter < max; counter = counter + 1 {
    t3 = t1 + t2
    echo(t3)
    t1 = t2
    t2 = t3
}

But this version:

#!/usr/bin/env abs
# the first 100 terms of the fibonnaci sequence

t1 = 0      # first term
t2 = 1      # second term

max = 100   # max number of iterations

echo(t1)
echo(t2)

for counter = 0; counter < max; counter += 1 {
    t3 = t1 + t2
    echo(t3)
    t1 = t2
    t2 = t3
}

Gives me this error:

parser errors:
        expected next token to be IDENT, got = instead
        [13:5]      t3 = t1 + t2
        no prefix parse function for '=' found
        [13:8]      t3 = t1 + t2
        no prefix parse function for '}' found
        [17:1]  }

Otherwise this is a nice little scripting language. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant