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?

10 comments:

  1. http://www.scsh.net/index.html

    ReplyDelete
  2. 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. Blog is informative and motivated me a lot!
    You have made an awesome attempt and is doing consistanty good.
    website design hampshire

    ReplyDelete
  5. 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
  6. You must be aware that scripting is not easy to get good at. Read as much in the wiki as you can, test it out in the Command bar and output, and try simple scripts to start with. Believe it or not, but tools that allow cars and airplanes to move are very advanced.It may take anywhere from weeks to years to get really good at scripting. However, this skill is very valuable in making pretty much anything you dream. That's what Roblox is all about.

    Property for Sale

    ReplyDelete
  7. Lots of thanks for this post. I think it is a very good post. It helps us many away. So many many thanks for this article.

    homes and land for sale

    ReplyDelete
  8. Greeting everyone, tally a overnice article. I see this place and get lot of essential program. I intercourse this business few of my familiar friends and they acquiesce to trip this tract. Thanks


    cheap price house

    ReplyDelete
  9. Very nice and helpful information have been given in this article. It’s a most important post. Please every one visit this site quickly. Thanks.

    Houses for sale

    ReplyDelete
  10. These three biggest moneylenders that are left are JP Morgan, Wells Fargo and Countrywide. The three organizations are not forcefully looking for these sorts of advances and are turning out to be less dynamic in the less couple of months. The issue with this is it will prompt to less rivalry, considerably more tightly credit norms and higher loan fees. cash advance chicago

    ReplyDelete