Giving Some Back

Started by
33 comments, last by EDI 20 years ago
wrote the parser from scratch.

basicly all you have to do is understand and make use of the structure the language has, but it is by no means easy=)



Raymond Jacobs,

www.EDIGames.com

www.EtherealDarkness.com

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

Advertisement
How difficult was the parser to make? Did you encounter anything on that front which would be useful to us?
im pretty experienced with writing parsers,

i''ve written my own XML parser, and now my own C parser.

so im not sure if it was ''easy'' it really only requires knowledge of how to enumerate a string, and what to look for under certain conditions.

there was one thing that i found exceptionaly valuable in the parsing function, and i mentioned it above, normalizing the code.

taking,code which could be extreamly weirdly formated.

if(x == 2 + 5){

i = "cool" ;
}

and turning it into

if(x==2+5){i="cool"

by striping out all whitespace characters,

when doing this it is very important to watch out for string literals, when striping whitespace, if you encounter a " you should stop striping whitespace, until you encounter another "(one which is not escaped like \"), otherwise you will destroy string formating.

having a ''no white space'' code string to parse is much simpler and doesnt require code to skip through possible whitespace, which can clutter up the parser.



Raymond Jacobs,

www.EDIGames.com

www.EtherealDarkness.com

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

Ah, I assume you''d have several passes over the script? One to strip whitespace and normalise your input - then the next to process it etc? It''s the intial sweeps that got me - you should see the ugly hacks in my one-line game console text parser. heh.
hehe, yes i use 2 sweeps, normalization, compiliation.


Raymond Jacobs,

www.EDIGames.com

www.EtherealDarkness.com



[Edited by - EDI on May 19, 2005 10:29:12 AM]

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

This topic is closed to new replies.

Advertisement