CSE 321 Closed Lab 2 Warm-up Exercise


In preparation for this week's closed lab, you will design your own bug species for the BugsWorld contest that will take place during closed lab. This handout gives you a brief introduction to the applications involved and how to set up and run a simulation. Before closed lab you will need to familiarize yourself with all the tools and, most important, write your own BL program to create the invincible bug. A translator tool is provided so that you can fix any syntax errors in your BL program before Friday. You will also be able to run simulations to test the behavior and strength of your bugs.

On Friday, turn in a printed copy of the BL program for your bugs.

As we discussed in class, there are four applications that you need to be familiar with: the Translator, the Server, the Client, and the Display.

The Translator

The translator transforms a BL program into a compiled form that the Client can interpret. It is invoked with the command:

321_Translator < input.bl > output.bo

where input.bl is the text file containing the BL source program, and output.bo is the text file containing the string of integers representing the corresponding object code. Although you can name these files whatever you like, you may want to follow the convention that all BL source files terminate with ".bl" and all compiled BL files terminate with ".bo".

At this time, the translator provided does not print extremely useful error messages. It simply aborts execution as soon as it finds a syntax error, and prints a message stating what it expected instead. Although more helpful messages would certainly be convenient, the syntax of BL is simple enough that you should not have real problems fixing any syntax errors. You may want to start with a small program, and keep adding to it while periodically using the Translator to check that the syntax is correct.

The Server

To run a simulation, the first thing you want to do is start up the Server. This is done by simply invoking the command:

321_Server

In response to that, the Server replies with a message stating on what machine it is running and the port number clients can use to connect to it. You may want to write those down on a piece of paper since you will need them to start all Clients and Displays, and other output from the Server may make machine name and port number scroll out of view.

The Server has several command line options that can be used to modify its default behavior. Type

321_Server -h

to see a list of the options currently supported. For the time being, the defaults should be enough for your testing purposes.

Note that the Server will not stop running until you kill it. Please do not run it in the background and leave it running after you are done with it. Always make sure all the Servers you started are killed before you log out (use control-c in the xterm window where you started the Server to kill it).

The Client

Once the Server is up and running, and you know the machine name and the port number, you can start the clients. To start a Client type in a separate xterm window the command:

321_Client

In response to that the Client will ask you for three pieces of information: (1) the name of the file with the object code for the species of bugs that the client will handle; (2) the name of the machine on which the server is running; (3) the server port number. Answer each prompt with the appropriate information and the Client will connect to the Server and start interpreting the bugs program. (Note that although the Server will give you the complete name of the machine it is running on, e.g., alpha.cse.ohio-state.edu, you only need to give the simple name to the Client, e.g., alpha.)

The Client will print messages informing you of when a bug of your species has been born and when it dies. It will complete execution only when all bugs of your species are extinct or when the Server terminates.

The Display

After the Server is started and either before or after any Client is started, you can run a Display process. To start a Display type the command:

321_Display

The Display will ask you for the name of the machine running the Server and for the Server port number. Type the appropriate information and the Display window will appear showing what's going on in the simulation. The Display process will also keep executing until the Server is killed.

One final note: We tried to keep this handout as short as possible while still giving enough information to get you started with the translator and the simulation environment. If you need any further information, please post a message to the newsgroup or contact your instructor and we'll try to answer your questions.