Village Guard: keep getting different errors

This is my code:

// Patrol the village entrances.
// If you find an enemy, attack it.
while(true,
    moveXY(35, 34)
    leftEnemy := findNearestEnemy
    if(leftEnemy) then(
        self.attack(leftEnemy)
        self.attack(leftEnemy)
    )
    // Now move to the right entrance.
    // Use "if" to attack if there is an enemy.
   moveXY(60, 31)
   rightEnemy := findNearestEnemy
   if(rightEnemy) then(
   self.attack(rightEnemy)
   self.attack(rightEnemy)
)
)

Says maximum call stack exceeded.The other error I get sometimes is "Expecting ‘EOF’

Hello, Jacob, and welcome. For future reference, please read the FAQ on how to properly format code.

What language is this? I don’t quite know it, so I am sorry if I make errors based on what little I know.

I believe moveXY should have a self. before it, as should findNearestEnemy. Also, isn’t there a loop function granted by Programmaticon I?

I’m also confused while the self type is python the loops and conditions are JS

Maybe @nick will know

Looks like Io and Io is very experimental.

As to the code itself, it looks like proper Io (as far as I can tell, only having a very superficial knowledge of Io).

The expecting EOF, is a weird error since it looks like your parenthesis are matched up. So that I would guess is either a loading the level/etc, a memory corruption, or temperamental parser error.

The Io parser definitely isn’t complete enough to run that code, unfortunately. Try switching it back to Python from the game menu - change hero modal.