Re: CoreScript issues
- Posted by Robert Pilkington <pilking at BELLATLANTIC.NET> Aug 25, 1999
- 429 views
>I haven't looked at Llama yet (sorry David), but from what I've been >reading >it sounds fantastic. That is definitly a direction we could take it after >the commandline version is done... If it's ready to port, and Llama isn't ready yet (probably will be the case), it could be ported to Win32lib, since there aren't many differences (yet). >>>I just finished support for labels today. I'll post a copy when I test >>>it some more.. > >I sent a prototype version of CWC to Rod last night that includes support >for labels, among other things. I wanted to get a head start on coding >the >changes for his next version before it comes out ;) I've been thinking about expressions. I'm going to add them before I release the version I have. (Should be soon.) >Speaking of "coding changes before it comes out", I was at a Microsoft >seminar >today entitled 'Creating Dynamic Webpages with DHTML & IE5'. The >seminar's speaker >made a comment, in reference to emerging W3C standards on XML & CSS, that >I found a little funny: > > "Microsoft is always the first to implement new Internet standards. >That is > how we keep one step ahead of the competition, for example IE5's >support for > XML, CSS1 & 2, and the DOM." > >It seems to me that MS has taken _working_standards_ and extended them, >then >released their new version and tried to add the extensions to the >standards :) >In fact, the Document Object Model's (DOM) draft hasn't been finalized >yet >last I heard... Basically, "We stay on top of the compitetion by creating the standards they don't support."... :) (I want my replacement SideWinder Precision Pro joystick to come.. it's over a week overdue... It's a great stick.) >well, it's just an idea. I don't know if it would have any significant >advantage to having just labels, but I thought I'd throw the idea out and >see >what happened ;) I had already been thinking about them while I was doing labels. There are some areas in my warriors that expressions would make it a bit easier. >David Cuny has an expression evaluator named eval.zip, and Andy >Montgomery >has an expression evaluator named parse.zip. Both are on the archives >page >(try looking under "Math"). I've downloaded one from the Recent User Contributions, but it has too many features... It's better than the rest as far as the features I want to use. I'll need to strip it down some, though. > >--[Labels]-- > >>Basically, the first 'word' is the label if it isn't an instruction. > >I considered doing it that way, but I found it easier to just have >labels use a colon at the end (obviously). To me, having labels use >a colon seemed to be more natural way of doing it, but my BASIC roots >could be showing ;) Agh! Code written for mine won't work on yours (without colons), and code written on yours WILL work on mine... Making up some standards eh? ;) (Just kidding around. :) >One advantage to having labels end in a colon is for error checking. >If the first word isn't an instruction or label, then it's wrong. >If the first word is a label and the second isn't an instruction, then >it's wrong. Actually, from reading some files on pMARS, here is the basic idea for pMARS' parser: Read in the file First pass: Find labels Second pass: Evaluate labels and syntax check Look familiar? :) Also, it appears (I haven't tested yet), that ALL labels in front of an instruciton are added, in other words: so much for clear code: MOV bomb, @bomb JMP so JMP much JMP for JMP clear JMP code All of those JMP instructions would jump to that first line. I might modify my parser to do that. Why? I dunno... >>I scan all the lines. ><snip> > >Wow, we're totally separated, and yet coding as one mind. I wrote mine >almost identical to yours. Truly wierd :) And it looks like we're not the only ones. >Mine isn't truly two pass, but close enough: > >First pass: tokenize all the lines and strip blank lines. >Second pass: finds labels, adds them to a lookup table with their line >number, > and removes them from the line. >Third pass: interpret the opcodes and resolve any labels, return the >compiled > code to the calling routine. I do what you do in the first and second passes in the first pass. (After the lines are broken into each 'word', I check for the labels.) >The approach we took is the same, even though our code probably looks >different. >I'm seriously considering merging the first and second steps together, >but >we'll see (I'm waiting until I can remember why I did it that way :) That's simple: If you combined passes two and three, then this code wouldn't work: start MOV bomb, @bomb ADD #4, bomb JMP start bomb DAT #0 Why? Because on the first line, 'bomb' hasn't been added to the label list yet. But when you do the pass through all the code and get the labels before you handle the label referneces, it works.