overloading

Hello I am trying to do something for a assignment in order to make our programming language with c++ i have to overload operator [] and when I write
PERSON "LARRY" LEARN[
ACTIVITY_LEARN(Eat)
ACTIVITY_LEARN(Walk)
]
I have to put into a activity vector of object LARRY the string Eat and Walk the problem is that I have found a way to not use "" with stringify but I can't find any possible way to don't use commas how I can do that?
I am thinking something like put , when ACTIVITY_LEARN ends when I do the define but the last ACTIVITY_LEARN will have a , which will be unused and hits compile error how can I ignore it?
I am not sure I understand.

Are you trying to:

  1. create a toy language?
  2. modify C++ / use C++ in a weird way?
2. modify C++ / use C++ in a weird way?
Judging from his previous threads, OP is trying to implement an EDSL of some kind:
http://www.cplusplus.com/forum/general/266621/
Last edited on
It is for a assignment so I am trying to use C++ in weird way
The overloaded [] operator would take ...

PERSON "LARRY" LEARN[
ACTIVITY_LEARN(Eat)
ACTIVITY_LEARN(Walk)
]

... and then parse/tokenize it, not unlike the very well known calculator or instruction translator programs.
Topic archived. No new replies allowed.