What is Calq?

Calq is a web application that interprets a simple sequence of programming commands (click here for a list of calq commands). I encourage you to try it out by putting your commands in the top text-box (the bottom one is for results).

This project started as a teaching tool. In the "old" days, the family computer came with a version of the BASIC programming language. Many current computer scientists and computer engineers learned about programming with this language. They could type in a program, or even commands one-at-a-time, at the computer would respond. This experience is about getting the computer to do what you want; about telling the computer what to do, and having to refine the commands when they do not work as expected.

Today's typical family computer does not come with a programming language for curious beginners to explore. Instead, you would need to download and install the programming language. Free ones do exist, but the beginner may not even be aware of this. And installing software takes some level of technical ability that beginners lack.

This project aims to rectify the situation. It presents a simple interface; a text-box at the top for your commands, then an "evaluate" button, then a text-box for the computer-generated results.

Brief History

The first version was written in C++. A webpage presented the textbox for the commands, with an "evaluate" button. Pressing the button accessed the CGI program, which created a web-page as output. It could do basic calculation, and worked fairly well. I'm comfortable programming in C++, and I was able to re-use some C code from an earlier project. Also, C++ allowed some flexibility with the "union" keyword, where the program could store several different types of data in the same space, and return whatever form was desired. That is, a variable could be an integer, a floating-point (double) value, or a character, even though these have different representations internally.

But one thing bothered me about the above approach. The code would be interpreted by the CGI program, running on my server. This would not scale well at all. If the program became popular, then my computer would be slowed considerably by other people's usage. Also, there is the possibility that someone could write a program that never ends, but ties up my computer. A better approach would be for the interpretation to happen on the user's computer. Languages like Java and JavaScript would allow this.

I heard about Google's Web Toolkit (GWT), and realized that it could solve this problem. GWT generates JavaScript from Java programs. While the names are similar, Java and JavaScript are two different languages. The end result is that people could use Calq with a minimum of stress on my server, and could run it as long as they like on their computer. Could they create a Calq program that would take a lot of their computer's attention and not end? Yes, but all they would need to do is close their browser. It's a totally safe environment, even if they ask their computer to do something that never ends.

What is the difference between calq and Jcalq? Calq is what I called the original version, from "calculate" only with a "q". I started calling the Java version "Jcalq". But since it has worked out well, the "J" was dropped in future versions. The version number (such as 3.1) is enough to distinguish between versions.

Current Status

I don't get as much time to devote to this project as I would like. This means that progress is often made by large jumps, at irregular intervals. I have a lot of ideas about where this project should go, especially if I get some assistance.

Consistency has been a problem. An innocuous-looking change can cause a problem elsewhere. (For example, I recently standardized the variable access so that it occurs in only one spot. But this caused a problem with the FOR loop, where it would give an error because the index variable did not yet have a value.) To address this, I have a set of Test Cases that should work on the most-recent calq version. (Older versions may not support all commands in the test cases.)

Currently, it supports the following commands.

Version 2.1, supports these additions.

Version 2.1.2 supports these additions.

Version 2.1.3 supports these additions.

Version 2.1.4 supports these additions:

Version 2.1.5 supports these additions:

Version 2.1.6:

Version 2.1.7:

Version 2.1.8:

Version 3.0:

Version 3.1: (March 2013)

Version 3.2: (July 2013 to March 2014)

Version 4.0: (August 2014)

Version 4.1: (June, 2016)

Version 4.2: (October 2017)

So it's a calculator?

No. While it provides the functionality of a calculator, it is meant to be a scientific programming environment. While calculations are important, it also provides the structure and logic of a programming language.

Future Work

This is a work in progress. See the known bugs page for any problems.

It would be nice to add more functionality, including: These things can be added or fixed, but it takes time.

Postscript

Let me know if you find any bugs. I cannot guarantee that I'll answer back, but I appreciate your interest. If you send me an e-mail, put "calq" somewhere in the subject line so that my spam checker won't discard it. I do not have time to answer all e-mails that I receive.

Disclaimer: this is an experimental project. Do not assume that the results are valid.

This project is licensed through the GNU General Public License. If you want a copy of the source code, contact me (the author) below. I am interested in working collaboratively on this project. Be sure to put "calq" in the subject line of your e-mail.

How to cite

Citing a resource is when you publicly acknowledge it. In text, you put a label, like [3], or (Weeks2007), that corresponds to an entry in your references. The reference section then includes a lot more information, namely where other people can find it: the author's full name, the title of his/her paper, the journal that published it, the publisher, the year, the pages, etc. Typically, you see this in academic papers, but other places such as Wikipedia pages often include citations and a reference section. How do you cite this software? I propose this bibtex entry:

@misc{calq,
title = {Calq -- A Free, Web Browser Based Programming Language},
author = {Michael Weeks},
organization = {Georgia State University},
address = {Atlanta, Georgia, USA},
year = {2007--2021},
note = {version 4.2},
url = {http://hallertau.cs.gsu.edu/calq_latest},
}

If you use bibtex, just copy that and paste it in your references. If you don't use bibtex, you can copy and paste this instead:

Michael Weeks, "Calq (software)", version 4.2, Georgia State University, Atlanta, Georgia, USA, 2007--2019, Available at http://hallertau.cs.gsu.edu/calq_latest.

It's the same information, just in a different format. If you need to do this in APA, MLA, or some other format, simply change it as needed. Citing is important for people like me! It's the academic equivalent of a "like" button on social media. The more citations, the bigger the impact, and the more we are encouraged to continue to do it.

-Michael Weeks, mweeks [at] cs.gsu.edu, copyright © 2007-2019.

Michael Weeks, "What is Calq?", Digital Wave Systems Lab, Atlanta, Georgia, USA, 2007--2019, Available at http://hallertau.cs.gsu.edu/whatiscalq.html.