Well, once again, I'm back here asking my cyber-homies for some help.
Basically, I'm pretty much making a "word replacer". I'm writing a new browser script, and I'm creating a JS compiler. What the compiler will do is scan through a textarea and replace my script with JS. SO, after the user types in his program and clicks Compile (a button), it will document.write the program in JS. Kinda confusing?
Here:
Code:
Step 1: I type in my program in a text area:
  EX:
  <$ a = 8
  <$ b = 4
  [?echo<< a + b;
  It makes 2 variables, and writes the sum of them.

Step 2: I click compile
  JS scans through my textarea and replaces <$ with "var" and [?echo<<    with "document.write(".

Step 3: It writes to the screen the program compiled into JS.
Get it?