Simple compiler design help: Variable length arrays in Arduino? I'm trying to write a simple compiler in the Arduino language that I am making up for my lab.  The compiler will have to be able to turn a string like this:

"do command_one 3 times"


into a data structure that represents this:

&lt;command_one&gt;, &lt;command_one&gt;, &lt;command_one&gt; 


it should also be able to turn something more complicated like this:

"do do c_one do c_two 2 times 2 times c_thr 2 times"


into a data structure that represents this:

&lt;c_one&gt; &lt;c_two&gt; &lt;c_two&gt; &lt;c_one&gt; &lt;c_two&gt; &lt;c_two&gt; &lt;c_thr&gt; &lt;c_one&gt;
                &lt;c_two&gt; &lt;c_two&gt; &lt;c_one&gt; &lt;c_two&gt; &lt;c_two&gt; &lt;c_thr&gt;


Another function will then read the commands out one by one.

These examples show all of the functionality that I would want from the compiler.  

I'm having design issues for the compiler that I want to create.  Initially, I just wanted to do some string manipulation and turn the input string into an array of integers representing commands.  However, since the compiler will be outputting an arbitrarily large number of commands, and since arrays in Arduino need to be initialized with a length, this could be a problem.  

I am not fluent in Arduino so I am hoping that an Arduino whiz can show me a quick solution.  I have already come up with the suggested solution on my own in Python, however, my solution in Python has to do with the ability to change the length of lists on the fly.  

You will also notice that I posted the same question in the C++ stackexchange.  I am trying to write the same code for an Arduino and in C++.  I know that Arduino code is based on C++, if the answer is the same in Arduino as it is in C++ that would be very helpful.
The Arduino IDE features nearly full C++ language support (at least for C++03 features).
library support is limited, but any standard component you need, you should be able to get an open source implementation that compiles.
That said, you have 2K of RAM to work with on an Arduino, so the kind of C++ code you would write for a general purpose computer just won’t get you very far.
I could be wrong, but I very much doubt there are full Python implementations for Arduino.


Edit: Thanks to Mr. Penguin for pointing out that we’re dealing with an Arduino Due, not an Uno (I had overlooked the OP’s tag). 96K of memory is actually a decent amount to play with, so grab a library implementation like this one and use the C++ techniques you wish to use.