the comment filter should work flawlessly because it's not that complex 🙂 the filtering is done before all parsing and just looks for /* and deletes everything until the next */ it finds. nested /* */ aren't valid in AVS anyway 😉
and it looks for // and deletes everything until the next CR+LF.
Erm ok there is one issue with the comment filter: please dont use the string "fgsfoihjoadas" anywhere in the input because it will be replaced by a slash 🙂
after all of these constructed mini-examples here's a real example that might give you an idea of what you could do with the program. here's one of my presets i wrote with my tool. It's mainly for testing purposes since it has no beat reaction or own movement 🙂
It's a reflective sphere and a plane. the camera can be controlled by the mouse (hold left mouse button down to pan the camera) and the keyboard (cursor keys to move around).
if(bplane,assign(isplane,1),exec3(exec3(exec3(assign(kdist,
(sqr(dx) + sqr(dy) + sqr(dz))),assign(kp , (2*dx*(ox-mx) +
2*dy*(oy-my) + 2*dz*(oz-mz))/kdist),assign(kq , (sqr(ox-mx)
+sqr(oy-my)+sqr(oz-mz)-sqr(rad))/kdist)),exec3(assign
(kdet,sqr(kp/2)-kq),assign(k1,-kp/2+sqrt(kdet)),assign(k2,-
kp/2-sqrt(kdet))),exec3(assign(k1,if(below
(k1,0),INFIN,k1)),assign(k2,if(below(k2,0),INFIN,k2)),assign
(ksphere,min(k1,k2)))),exec3(exec3(assign
(ax,dx*ksphere),assign(ikx,ax+ox),assign
(ay,dy*ksphere)),exec3(assign(iky,ay+oy),assign
(az,dz*ksphere),assign(ikz,az+oz)),exec3(assign(xdist,ikx-
mx),assign(ydist,iky-my),assign(zdist,ikz-mz))),exec2(assign
(distkugel,sqrt(sqr(xdist)+sqr(ydist)+sqr(zdist))),assign
(isplane,above(abs(rad-distkugel),epsilon)))));
if(isplane,exec2(exec3(exec3(assign(pa,0),assign
(pb,0),assign(pc,1)),exec3(assign(pd,-40),assign(k1,(-pa*ox-
pb*oy-pc*oz-pd)/(pa*dx + pb*dy + pc*dz)),assign(kplane,if
(below(k1,0),INFIN,k1))),exec3(assign(k,kplane),assign
(ix,dx*kplane+ox),assign(iy,dy*kplane+oy))),assign
(iz,dz*kplane+oz)),exec3(exec3(exec3(assign
(k,ksphere),assign(ar,invsqrt(sqr(ax)+sqr(ay)+sqr
(az))),assign(ax,ax*ar)),exec3(assign(ay,ay*ar),assign
(az,az*ar),assign(nx,ikx-mx)),exec3(assign(ny,iky-my),assign
(nz,ikz-mz),assign(nr,invsqrt(sqr(nx)+sqr(ny)+sqr
(nz))))),exec3(exec3(assign(nx,nx*nr),assign
(ny,ny*nr),assign(nz,nz*nr)),exec3(assign(bx,nx-(ax-
nx)),assign(by,ny-(ay-ny)),assign(bz,nz-(az-nz))),exec3
(assign(k1,(-pa*ikx-pb*iky-pc*ikz-pd)/(pa*bx + pb*by +
pc*bz)),assign(kplane2,if(below(k1,0),INFIN,k1)),assign
(ix,bx*kplane2+ikx))),exec2(assign(iy,by*kplane2+iky),assign
(iz,bz*kplane2+ikz))));
The first if() makes sure the sphere is only raytraced if the viewer is not on the wrong side of the plane.
The second if() does the reflection calculations only if the sphere is actually hit (anyone got better code for determining this instead of the approximating code? 🙂 ).
The non-translated code is provided in the comments after the DM and the Texer II respectively.