Ch—an interpreter for C

Back to CS16 topics

Introduction

In CS16, we are using the Ch interpreter rather than standard C.

We are using Ch because we believe it will make learning C easier.

Ch was developed by Harry H. Cheng, a Professor from UC Davis. Ch is offered as a commerical product by SoftIntegration, Inc., a company founded by Dr. Cheng.

Although Ch is a commerical product, CS16 students will not have to purchase anything.

If you are a CS16 student, you'll be given a username and password for a "CSIL account" that you can use to access Ch, either

It is also possible to download a version of Ch for your own PC of Mac—however, this is not necessary. As long as your PC or Mac is connected to the Internet, you can use your own computer to access Ch over the network without downloading and installing it. As we explain below, working this way has several advantages.

Using Ch

Using Ch on the Computer Science Department Computers (CSIL)

Ch should be available on all computers in the Computer Science Instructional Laboratory (CSIL).

Here's an example of how to access Ch. This example shows:

Example Ch session on CSIL computers

First, log into one of the computers in CSIL, or access CSIL via an ssh program over the internet.

Then, use the ch command to bring up ch. Here is a sample session:

-bash-3.2$ ch
                                   Ch 
                Professional edition, version 6.1.0.13701 
              (C) Copyright 2001-2008 SoftIntegration, Inc.
                     http://www.softintegration.com                
/cs/faculty/pconrad> printf("Hello World\n");
Hello World

/cs/faculty/pconrad> 3 + 4 * 5 
23 
/cs/faculty/pconrad> exit
-bash-3.2$ 

Customizing the Ch prompt

One feature of Ch that is sometimes helpful—and sometimes annoying—is that the prompt changes to your current directory plus the ">" by default.

This is helpful for remembering what your current directory is, but it can be annoying if, for example, your prompt is something like the following, and you are starting to run out of room to type in commands:

/cs/student/giovannaandreeson/cs16/lab00/>

In this case, you may want to set your prompt to something shorter. This example shows how. The part you type is indicated in bold. Note that the 2+3 isn't part of what's necessary—it is just there to illustrate how the prompt changes. I'm not sure why after the initial command the Ch> prompt appears twice—maybe its a bug?

-bash-3.2$ ch
Ch Professional edition, version 6.1.0.13751 (C) Copyright 2001-2009 SoftIntegration, Inc. http://www.softintegration.com /cs/faculty/pconrad> _prompt = "Ch> "
Ch>
Ch> 2+3
5
Ch> exit
-bash-3.2$

This approach requires you to type the _prompt = "Ch> " command each time you enter Ch. If you want the change to be permanent, section 4.1 of the Ch User's guide describes how to accomplish this.

Accessing CSIL from your PC or Mac

The preferred computing environment for you to use in CS16 is the CSIL computing environment.

You can access the CSIL environment in the following ways:

Downloading Ch directly to your PC or Mac (not required)

Why you might want to just skip this

Let us emphasize again: it is NOT REQUIRED for you to download Ch to your PC or Mac.

In fact, there are many advantages to completing your work on the CSIL machines—either direclty, or remotely from your PC or Mac, instead of downloading Ch to your PC or Mac.

   
   

 

This last point is perhaps the most significant—although you are welcome to try downloading and installing Ch on your PC or Mac, we cannot provide technical support if you run into difficulties with your own personal installation of Ch.

Why?

If you still want to do this, here's how

If after all that, you still want to download a student copy of Ch for yourself, here are the download links.

Note that you will have to register yourself with SoftIntegration in order to download this software (another reason we are not requiring you do to this.)

Then, follow the instructions on the website for