Re: Euphoria Interpter ?
- Posted by cklester <cklester at yahoo.com> Nov 17, 2005
- 1344 views
Matt Lewis wrote: > Bernie Ryan wrote: > > If Euphoria code is read and parsed before running then > > Why can't the parser use the idea of of using #if #else #endif to > > to control what code is read or not read by the parser > > in other words conditionally process the input. > It's definitely possible to do this. But not necessarily simple or easy. #if platform() = LINUX then -- do something #else -- do something else #end if > You're basically embedding another language into euphoria--and one that > executes immediately, changing the state of the interpreter. I don't see this, but I'm not an expert on interpreters either. So here's my POV: For the conditional above, the interpreter can simply treat the disqualified code as comments, can't it? The interpreter isn't executing code, it's just determining what should be included in the program code. So, if I'm on Linux, the code in the else clause above will not be included in the final program (and the lines starting with '#' get stripped as well). This would work for dynamic includes: #if platform() = LINUX then include linux.e #else include winblows.e #end if -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/