Posts filed under 'programming languages'

programming language

Another one on one of my favorite topics, programming languages, here’s an interesting thing about the LOLCODE language.

Add comment October 17th, 2008

sweave / latex compile script

Ah, just because I got tired of typing latex; bibtex; latex; latex; dvipdf every single time I wrote a little script a few months ago to do that. Of course, the script is super simple:
latex $1; bibtex $1; latex $1; latex $1; dvipdf $1; cleanup
whereby cleanup refers to another little script that just deletes all Latex’s intermediary files. (Perhaps there is a Latex setting to have them saved in an entirely different place anyway, wouldn’t there be?)

Later I added one for the rare occasion that I use Sweave as well to integrate R code into my Latex files. Now I am also starting to become a fan of the pic language to add diagrams to my files and it also integrates very well with Latex. So now I upgraded my script a little and just post it here in the odd case that it turns out to be useful for someone else as well. The Sweave version:

#!/bin/sh

R CMD Sweave $1

fn=c`date +"%M%S"`

pic -t $1.tex > $fn.tex
rm $1.tex

latex $fn
bibtex $fn
latex $fn
latex $fn

dvipdf $fn $1.pdf

rm *.aux
rm $fn*

I had tried Sweave earlier but was not too satisfied, since most things I was estimating took too long to have them run every time I compile my text. But now I have been working on a document with a lot of straightforward regressions, several plots, and several diagrams, and the final layout is only of importance as an internal working document - not for publication - so I have been making heavy use of both Sweave and pic and I am really enthousiast about the result.

Add comment October 5th, 2008

designing programming languages

Recently, I stumbled on the Io programming language. It’s a cool language, primarily because of its elegant simplicity. In fact, the entire website of the author is quite interesting and similarly elegant through simplicity, as his quotes page suggest not entirely by accident.

Although I cannot find the web links that brought me from one to the other, reading about this language made me read briefly about an older language under the same name, Io, of which the only main presence is a reference to it in Raphael A. Finkel (1995), Advanced Programming Language Design, which turns out to be a freely available book with really very interesting content. So, the last few days I have been reading the first couple of chapters from this book.

Stumbling from one interesting site about language to another, I just now stumbled on this description of the Q-BAL programming language. A language designed purely for fun, not for any practical use, but it’s pretty cool, again due to its simplicity, but also because of its twist of thinking in terms of queues instead of stacks.

All this is obviously distracting me from more urgent work / research, but it is pretty interesting reading. So many programming languages in the end look so similar, either object-oriented or imperative with very little variations, that it is refreshing to read more about how functional language work or what kind of other variations one can think of.

Add comment May 30th, 2008

10 years to program

I quite like this little page by Peter Norvig on how to become a good programmer. One quote I like: “Learn at least a half dozen programming languages. Include one language that supports class abstractions (like Java or C++), one that supports functional abstraction (like Lisp or ML), one that supports syntactic abstraction (like Lisp), one that supports declarative specifications (like Prolog or C++ templates), one that supports coroutines (like Icon or Scheme), and one that supports parallelism (like Sisal).” But he has generally interesting comments.

Add comment January 4th, 2007

ruby

Because of a project I am planning with a friend of mine, I have been spending a little bit of time studying Ruby on Rails in more detail. So far, I’m quite impressed. Ruby on Rails is a scripting language similar to PHP or ASP, but it also handles a lot more behind the scenes than any of those languages do. With only very few lines of code you can set up a page to list items in a database, edit them, delete them, etc. By just creating a table in a database and one command you can tell the system to create the scaffolding of an entire application. You of course end up rewriting most of the scaffolding to customize the page to your requirements, but it makes it incredibly easy to test parts of the site, since all is working at least in a preliminary sense within no-time. It’s like a scripting language on top of a game engine - the whole engine for the website is there, you just need to script the particular use you want to make of it.

I’m reading The Pragmatic Programmers - Agile Web Development with Rails now, which shows how to develop a basic shopping cart application, while demonstrating all kinds of good programming practice: separating layout from code; testing habits; etc. Really quite nice and quick to read. After this, I should be able to develop a website using Ruby on Rails in no-time.

Add comment December 23rd, 2006

benchmarking programming languages

Here is an interesting site benchmarking programming languages. Since all code is included, it’s also a nice overview of the basic syntax of a fairly large number of different languages. OCaml looks rather intruiging, for example.

Add comment October 26th, 2006

c links

Still reading Kernighan & Pike, The Practice of Programming, which I like a lot, and made me more curious about who this Kernighan guy is. So I checked his website, followed some links, and get more and more interesting information, way too much for me to actually read today. So here’s just a few links so as not to lose them:

Add comment October 23rd, 2006

compiler fantasies

After seeing my boss’ hand in bandage due to using the computer too much, I’m wondering whether it would be possible to develop a VoiceIDE, an IDE based entirely on voice commands. The programming language itself would probably have to be adjusted to be easy to pronounce. E.g. try to say a regular expression out loud! Kaya might actually be well on the right track, with largely text-based commands instead of too many () and []. But it should be possible to improve on that.

It would involve:

  • Building a good GUI;
  • Developing a new language incl compiler and debugger;
  • Using speech to text and text to speech modules;
  • Building a nice programming interface that automates wherever possible.

Using voice commands requires a lot of differences with regular IDEs, like commands to quickly move around your code, interfaces to select variable names, etc.

If developing a new language, it would be nice to have a language that is elegant and safe, like Kaya, but that creates code close to C speed. So it should still be fairly close to computer language and allow for a lot of flexibility, like pointers. All added safety comes at a cost of less flexibility, though, so this requires a lot of thinking.

Another idea I had was to perhaps rewrite the Kaya compiler in C. Try to make it run much faster than the current compiler and in the process write out the documentation, since that is still practically absent. But I should first have a really close second look at Kaya whether it is really worth investing any time in.

Add comment October 20th, 2006

some books and kaya

In relation to a query by an client, I had to look up a bit of information about memory management. There is a very interesting page on Unix and C/C++ Runtime Memory Management (I read up to here) and Micah Altman gave an interesting presentation on the subject.

Earlier today I have to go to the library in the applied sciences faculty and there were several seemingly very cool books. One was by Bill Blunden, Virtual Machine Design and Implementation in C/C++, about the design of the HEC virtual machine. Seems intruiging, although a lot of plain code instead of text. Another book was called Computer Arithmetic, by Parhami, about the real nitty-gritty details of the algorithms and circuit designs used for processors to do arithmetic.

Last night I looked at some presentations about Ruby on Rails. It’s intruiging - about three lines of code to have a complete online form linked to a database etc. It just basically automates an enormous amount of coding between the SQL database and the webpage to maintain it. Useful for many applications, I think, but not really for online game design. It feels like giving up a little bit too much control, though, but that’s just a feeling ;) .

I also spent a tiny bit more time on Kaya, trying to see how the webprog library works. It’s badly documented and the tutorial is outdated, but the source code of the library is simple enough to figure out what to do. I miss syntax highlighting in Emacs, though! The webprog part makes it quite easy to write proper webpages in Kaya code without being too much bugged down by HTML syntax, which is nice. Here’s the tiny sample program I tried:

webprog webhello;
import Webprog;
import HTMLDocument;

HTMLDocument webmain()
{
doc = HTMLDocument::new(HTML4Strict, "Test webpage");
blog = addDivision(doc.body, "My blog", "blog");
return doc;
}

Which, after very slow compiling, produces:

Content-type: text/html; charset=UTF-8
My blog

In other words, I did not have to worry about any HTML syntax, and I can determine all layout issues with CSS by simply using the

Maybe I really should consider working on an Emacs environment for Kaya and a GeSHi language file to make the above sourcecode look nice!

Add comment October 12th, 2006

kaya, cantr, and learning how to program

On Friday morning I saw a link to the intruiging but utterly useless Whitespace programming language, which in turn refers to the language in development Kaya. Kaya looks pretty cool. It’s based on Haskell, which I don’t really know, and thus not object-oriented but functional language. They call it a scripting language, but it’s really more a general programming language, I think. It has many features geared towards server-side web development and it has nice quirky features I didn’t know before. It is a clear attempt to keep the language simple but take good things from many languages. The community on the mailinglist is also very friendly.

But then, I spent hours and hours - well, doing other stuff in between - trying to get the Kaya compiler to compile and run. I missed all major libraries it uses - probably a sign of how outdated our Cantr II server is, which is a bit of a worry. Eventually it worked (this RPM search engine was invaluable), but then I get compiler errors on the most basic tutorial examples. And the documentation, except for one non-exhaustive tutorial, is practically non-existant. So it’s both cool to see a language in it’s very early yet promising stage of development, but it’s also clearly risky to use it on a bigger scale.

Then Monday and Tuesday this week were almost entirely spent on server management. For unknown reasons, the server had rebooted on Monday morning, and we had the wrong mysql server version in the boot script, resulting in all kinds of SQL errors about corrupted and missing data. It took hours before we figured out what happened and then quite some time to get it all back up and running. And from out of shock we finally set up proper automatic daily backups for the database … which I see now didn’t actually work.

I really want to make it a project to simplify things in the next few months. Clean up the server and remove obsolete stuff; clean up the Cantr organisation and remove unnecessary elements; clean up the Cantr game design and remove unnecessary features.

I just read an interesting blog with an interview of some of the most prominent programmers, including the designers of C++, Linux, Ruby, Python, etc. Very interesting. Especially the sections on what books they recommend. Linus Torvalds and Bjarne Stroustrup both recommend Kernighan & Ritchie, The C Programming Language. Linus goes on recommending Patterson & Hennessy, Computer Architecture: A Quantitative Approach and Crawford & Gelsinger, Programming the 80386. David Heinemeier Hansson recommends Beck & Andres, Extreme Programming Explained and Peter Norvig suggests Abelson & Sussman, Structure and Interpretation of Computer Programs. Finally, both James Gosling and Tim Bray suggest Programming Pearls by Jon Bentley.

Through this interview I also just found the Dojo Toolkit which is somewhat similar to Google’s Web Toolkit, but both more advanced and in a more premature state (that is, some of the examples don’t seem to work on my computer). Interesting drag-n-drop features.

Note to myself: I really need to figure out what Ruby on Rails is all about …

Add comment October 11th, 2006

Previous Posts


Calendar

November 2008
M T W T F S S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930

Posts by Month

Posts by Category