etanzapinsky / mongoose

Mongoose Simulation Language
1 stars 1 forks source link

comments don't work inside the environment block #13

Closed christopher-haueter closed 11 years ago

christopher-haueter commented 11 years ago

@mnrubin @meirf

mnrubin commented 11 years ago

comments are a lexer thing, shouldn't be related to the grammar in any way. keep in mind a comment goes from the # till the end of the line. Mind sharing the code that's not working?

On Thu, May 9, 2013 at 4:17 PM, Chris Haueter notifications@github.comwrote:

@mnrubin https://github.com/mnrubin @meirf https://github.com/meirf

— Reply to this email directly or view it on GitHubhttps://github.com/etanzapinsky/mongoose/issues/13 .

christopher-haueter commented 11 years ago

This works:

environment{
    int[2][2] x
    x[1][1] = 3
    print(x[1][1])
    # spurious comment
    action{
    }
    populate{       
    }
}

terminate{
}
analysis{
}

This does not:

environment{
    int[2][2] x
    x[1][1] = 3
    print(x[1][1])
    # spurious comment

    action{
    }
    populate{       
    }
}

terminate{
}
analysis{
}
mnrubin commented 11 years ago

it's possible that the issue is related to the newline/statement_list bug that Etan just caught and fixed. Try again when he pushes the bugfix. I doubt it's specific to the environment block, and prob has to do with the newline

christopher-haueter commented 11 years ago

Still breaks for me:

environment{
    int[2][3] x
    x[1][1] = 1
    print(x[1][1])
    x[1][2] = 2
    print(x[1][2])
    int y = x[1][1]
    print(y)
    # comment

    action{
    }
    populate{       
    }
}

terminate{
}
analysis{
}

Yields:

(plt)➜  mongoose git:(dev) ✗ ./manage.sh parser/main.py sample_code/list_declaration_and_access.mon
LexToken(NEWLINE,'\n',10,123)
Syntax error in input:
    Input: LexToken(NEWLINE,'\n',10,123)
Syntax error in input: program order must be: [agents] environment terminate analysis
result is of type <type 'NoneType'>
done

@meirf @mnrubin

mnrubin commented 11 years ago

what do you mean by "it breaks" ? What type of error are you getting?

On Thu, May 9, 2013 at 5:39 PM, Chris Haueter notifications@github.comwrote:

Still breaks for me:

environment{ int[2][3] x x[1][1] = 1 print(x[1][1]) x[1][2] = 2 print(x[1][2]) int y = x[1][1] print(y)

comment

action{
}
populate{
}

}

terminate{ } analysis{ }

@etanzapinsky https://github.com/etanzapinsky

— Reply to this email directly or view it on GitHubhttps://github.com/etanzapinsky/mongoose/issues/13#issuecomment-17691642 .

christopher-haueter commented 11 years ago

@mnrubin look again

mnrubin commented 11 years ago

ah, sorry, that last bit didn't show up in the github email. I'll take a look tomorrow, at this point our errors are a bit general so it may be hard to tell what the problem is exactly, but it has something to do with the newlines I'd wager. Meir and I will fix it, thanks for finding the bug

mnrubin commented 11 years ago

This worked without problems (we just ran it). Are you still getting a bug @chrishaum ?

christopher-haueter commented 11 years ago

I haven't seen it again.