Jump to content
  • Advertisement
Sign in to follow this  
ThoughtCriminal

handling symbol redefinition (parsers)

This topic is 4910 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just a quick MASM example: foo dd 0 FOO dd 0 error A2005: symbol redefinition : foo How do parsers handle the case of symbols? I think so internally will change all to upper or lower. I tried to Google but have not found anything. So any tips on managing case in parsers? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
For symbol tables in languages where identifiers are case-insensitive, parsers generally store the entries indexed with the all upper or all lower case. More recent parsers will also store the original string as a data member for the symbol entry so the symbol can be referenced by the symbol table as the original case that the user had entered.

Share this post


Link to post
Share on other sites
Hmmmm, you gave me an idea.

I think what you are saying is if the parser reads the symbol:

Foo dd 0

The symbol manager could give it an internal name toupper FOO.

But later on if the paser finds:

fOO dd 0

The symbol manager would try to give it the internal name FOO, but with a check should find that FOO is already taken internally thus a symbol redefinition has occured.

A user name: Foo , and an internal name FOO. Force the internal names to upper or lower case and any case of ambiguity is removed.

Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!