[Wave] Modifying the way function-like macros are interpreted

I am trying to use boost::wave as a preprocessor for LSL, a language used in the virtual world Second Life. There is a data type there for collections of data, but it can only be accessed through functions such as llList2String(list,iterator); I wanted to define macros that would allow me to do something like #define x[y] llList2String(x,y), however, wave as it stands does not seem to have any immediately obvious way to do this.

On Fri, Dec 25, 2009 at 7:10 AM,
I am trying to use boost::wave as a preprocessor for LSL, a language used in the virtual world Second Life.
There is a data type there for collections of data, but it can only be accessed through functions such as llList2String(list,iterator); I wanted to define macros that would allow me to do something like #define x[y] llList2String(x,y), however, wave as it stands does not seem to have any immediately obvious way to do this.
Wave is a C++ preprocessor, you are talking about mutating a language in a way not supported in a C preprocessor type way. First question must be asked, does LSL use the [ or ] tokens at all at any time in its grammar?

I am trying to use boost::wave as a preprocessor for LSL, a language used in the virtual world Second Life.
There is a data type there for collections of data, but it can only be accessed through functions such as llList2String(list,iterator); I wanted to define macros that would allow me to do something like #define x[y] llList2String(x,y), however, wave as it stands does not seem to have any immediately obvious way to do this.
As Wave is a preprocessor conforming to the C++ Standard this is not possible. But you can define your macro like #define x(y) llList2String(x,y) if that's an option. OTOH, Wave is open source, so you should be able to find the corresponding code to add your syntax. Do you want _all_ macros to be defined using the [] syntax or is this something you want to have additionally to the 'normal' function style syntax? Regards Hartmut --------------- Meet me at BoostCon www.boostcon.com

As Wave is a preprocessor conforming to the C++ Standard this is not
possible. But you can define your macro like
#define x(y) llList2String(x,y)
if that's an option.
OTOH, Wave is open source, so you should be able to find the corresponding code to add your syntax. Do you want _all_ macros to be defined using the [] syntax or is this something you want to have additionally to the 'normal' function style syntax? As far as I can tell, x(y) treats it as a function named x with a argument, not the x as a argument itself to do (y) on; in any case I wanted it in addition to the normal behavior.
Also, LSL does not use [] except for defining lists, e.g. list ex = [entry1,entry2,entr3];, or as a argument to a function, func([1,2,3],.. , but never in this particular manner, which would involve alphanumeric characters from the var name directly preceding the [. I was just wondering if there was something I could easily change to allow for this through wave.

On Fri, Dec 25, 2009 at 10:31 AM,
As Wave is a preprocessor conforming to the C++ Standard this is not
possible. But you can define your macro like
#define x(y) llList2String(x,y)
if that's an option.
OTOH, Wave is open source, so you should be able to find the corresponding code to add your syntax. Do you want _all_ macros to be defined using the [] syntax or is this something you want to have additionally to the 'normal' function style syntax?
As far as I can tell, x(y) treats it as a function named x with a argument, not the x as a argument itself to do (y) on; in any case I wanted it in addition to the normal behavior.
Also, LSL does not use [] except for defining lists, e.g. list ex = [entry1,entry2,entr3];, or as a argument to a function, func([1,2,3],.. , but never in this particular manner, which would involve alphanumeric characters from the var name directly preceding the [. I was just wondering if there was something I could easily change to allow for this through wave.
In that case you could easily make a stand-alone parser out of Spirit.QI that can do what you wish. Use of the symbol table and skipping things you are not matching will work perfectly. I doubt you would want to use Boost.Wave though as it would be difficult to edit and would do a *lot* more then necessary (and be slower because of that).

On 12/25/2009 12:59 PM, OvermindDL1 wrote:
In that case you could easily make a stand-alone parser out of Spirit.QI that can do what you wish. Use of the symbol table and skipping things you are not matching will work perfectly. I doubt you would want to use Boost.Wave though as it would be difficult to edit and would do a *lot* more then necessary (and be slower because of that). ______________________________________________
I still need wave as I am using it to provide #include and #define functionality, which LSL does not support. This however I have already implemented, I'm just trying to expand the functionality as much as I can using various preprocessing. I'll look up Spirit.QI though.

fractured@modularsystems.sl wrote:
I am trying to use boost::wave as a preprocessor for LSL, a language used in the virtual world Second Life.
participants (4)
-
fractured@modularsystems.sl
-
Hartmut Kaiser
-
Nat Goodspeed
-
OvermindDL1