Re: Euphoria pre-processor
- Posted by David Cuny <dcuny at LANSET.COM> Sep 01, 1998
- 439 views
[Jeffry Fielding wrote about his pre-processor] You can find my own Euphoria pre-processors on the Euphoria pages. My first (and most successful attempt) is called PP, and it implements a number of interesting features: case statements, C-like assignment ( +=, &=, etc.) as well as some loop constructs borrowed from ABC. I've also got a second pre-processor (still on the Recent Contributions, I think) called DOT which converts dot notation instructions such as: foo.append( "bar" ) if x.length > 0 then screen.puts( "ok" ) end if into: foo = append( foo, bar ) if length( x ) > 0 then puts( screen, "ok" ) end if It's smart enough to know what calls get expanded to functions, and which get expanded to procedures. PP is the more complex of the two, because it does it's best to maintain proper formatting and comments when rewriting the code. Both of these pre-processors integrate into my editor (EE), so when you select Run, they automatically are pre-processed and then run. Errors generated by the pre-processor generate EX.ERR compliant error messages, so even the errors generated are integrated. If you are interested, I've also written code which parses much of Euphoria's syntax (and generates appropriate error messages). I suspect that it is akin to your tokenizer. It does not actually generate any code, although that would not be that difficult to add. If you want, I can e-mail it to you. -- David Cuny