Monday, February 22, 2010

Arc (Jarc) or anything as a scripting language

I'm testing the hypothesis that Arc could be used as a scripting language. I'm using Jarc, my own Arc interpreter, of course. This is easy on OS X because the execve() system call accepts any number of arguments. So I can start a script with
#!/usr/bin/java -cp /usr/local/lib/jarc.jar jarc.Jarc
But it doesn't work on Linux since the execve() system call only accepts one argument. :-( So I wrote a little C program, which was fun since I haven't written any C in over a decade at least. So now I can do
#!/usr/local/bin/jarc
And voila! I can write scripts for Linux too. You can read the whopping 26 lines of jarc.c if you are interested in the not so fascinating details. Yeah, it'll probably need to be enhanced so I can pass JVM args also. But I haven't needed that yet, and I'm on a write-it-when-you-need-it regimen.

The other ugly bit is that I actually had to change the Jarc parser. Of course, this is the great thing about writing your own language implementation---you can change whatever you want! Jarc has to ignore the first line of the file. So it treats # in line 1 column 1 as a comment character. Yes, I could have had jarc.c make a temporary file without the first line, but that seems inelegant, though much more general purpose. So this requires the latest Jarc (version 2) which I released last week on Jarc SourceForge download page. Now whatever will I do with it?

5 comments:

  1. dasickisMar 10, 2010 07:09 PM
    http://www.scsh.net/index.html
    ReplyDelete
  2. seo melbourneOct 5, 2010 01:54 AM
    You have written about the scripting language it so good article really i like it thanks for sharing.
    internet marketing melbourne
    ReplyDelete
  3. Hi!
    Your topic on the scripting language Its very nice topic because your topic of concentration is also very excellent. You have plant a very significant concern. I liked it. Thanks for sharing with me.

    Toronto Marketing Company
    ReplyDelete
  4. SEO SouthamptonDec 13, 2010 03:05 AM
    Blog is informative and motivated me a lot!
    You have made an awesome attempt and is doing consistanty good.
    website design hampshire
    ReplyDelete
  5. MyWebsiteOct 8, 2011 04:15 AM
    Hi! Nice post. I learn something more challenging on different blogs every day. It will always be stimulating to read content from other writers and practice a little something from their store.

    how to advertise your website
    ReplyDelete