Running Cecil, Diesel, and Vortex at UW

You can easily compile and run your own Cecil and Diesel programs on UW CSE research and instructional machines running Linux or MacOS X.  You also can use Cecil and Diesel on Windows, as described towards the end of this page.

If you want to run Cecil or Vortex on a Linux, MacOS X, Windows, or other Unix-like machine outside the department (i.e., outside the department's trusted subnetwork that allows access to /cse/courses/misc_lang/vortex), then read the instructions in /cse/courses/misc_lang/vortex/REMOTE/README.

The Cecil Evaluator

For small experimentation with simple Cecil code, the Cecil evaluator is a fine option. First, log in to an instructional or research Linux or MacOS X machine. Then run the Cecil evaluator by executing /cse/courses/misc_lang/vortex/run-cecil.  At the Cecil> prompt, enter expressions you'd like to evaluate.  You can invoke any methods and instantiate any objects from the Cecil standard library.  You also can define your own objects, methods, fields, and variables.  You can write Cecil code in separate files, and then evaluate the contents of those files using Cecil include declarations. (Cecil mode for emacs is available below.)  The evaluator will perform typechecking of any expressions or declarations you enter.  It's even possible to redefine methods and fields; duplicate declarations of variables and objects will be ignored.  Note, however, that the Cecil evaluator's performance is relatively poor.  Some additional information is available in /cse/courses/misc_lang/vortex/notes/QUICK-START-CECIL; $VORTEX_HOME in that file refers to /cse/courses/misc_lang/vortex.  Cecil manuals are available below.

The Diesel Evaluator

For small experimentation with simple Diesel code, the Diesel evaluator is a fine option. First, log in to an instructional or research Linux or MacOS X machine. Then run the Diesel evaluator by executing /cse/courses/misc_lang/vortex/run-diesel.  At the Diesel> prompt, enter expressions you'd like to evaluate.  You can invoke any functions and instantiate any classes from the Diesel standard library.  You also can define your own modules, classes, functions, methods, fields, and variables.  You can write Diesel code in separate files, and then evaluate the contents of those files using Diesel include declarations. (Diesel mode for emacs is available below.)  The evaluator will perform typechecking of any expressions or declarations you enter.  It's even possible to redefine functions, methods, and fields; redeclarations of variables and classes will be ignored.  Note, however, that the Diesel evaluator's performance is relatively poor.  Diesel manuals are available below.

The Vortex Compiler

For larger programs, the Vortex compiler is the best tool.  Vortex is an optimizing compiler for Cecil and Diesel, as well as several other object-oriented languages including Java and (in the past) C++, Modula-3, and Smalltalk.  (The Vortex compiler includes the functionality of the Cecil evaluator, too, so if you start up Vortex, you can do all the things at the Vortex> prompt that you could do at the Cecil> prompt.)

To compile a Cecil or Diesel program using Vortex, follow these steps (look at the How to Use the Vortex Compiler manual for more information, or look at /cse/courses/misc_lang/vortex/notes/QUICK-START-VORTEX; $VORTEX_HOME in that file refers to /cse/courses/misc_lang/vortex):

  1. Create one (or more) files with Cecil or Diesel code in some directory. Let's say the directory is MYDIR and the main file is called mytest.cecil (or mytest.diesel).
  2. There is a lot of Cecil and Diesel code to look at for examples. It's all under /cse/courses/misc_lang/vortex/{Cecil,Diesel}/src. You may be interested in looking at the following subdirectories: Cecil/src/benchmarks/tiny, Cecil/src/contrib, Cecil/src/stdlib (sources for the standard library except the evaluator), and Diesel/src/stdlib. The Vortex compiler source code is in the Cecil/src/compiler subdirectory. The Whirlwind compiler source code is in the Diesel/src/whirlwind subdirectory.  Cecil and Diesel modes for emacs are available below.

  3. In a shell window, cd to MYDIR.
  4. Start Vortex by running /cse/courses/misc_lang/vortex/run-vortex.
  5. If compiling Diesel code, at the Vortex> prompt, enter lang diesel. (The default input language is Cecil.)
  6. At the Vortex> prompt, enter typecheck mytest (or tc mytest) to typecheck your program. After doing program editing, you can do typecheck (or tc) again to typecheck only the files you changed or that had type errors previously, or fulltypecheck (or ftc) to retypecheck everything. Although Vortex does not require you to typecheck the code before compiling, it's always a good idea to typecheck first, since it will help you catch errors earlier.
  7. To compile your program, enter make at the Vortex> prompt. This will build an executable named mytest, by default in the gen subdirectory. If you later make changes to your program, just enter tc and make again to recompile it. (Vortex handles its own recompilation dependencies; there are no separate makefiles to manage.) You generally should keep Vortex running while doing editing, compiling, and testing, so that Vortex will incrementally recompile your program rather than starting from scratch to recompile your program. (And see the instructions about saving and loading checkpoints, below.)
  8. Run your program, either by entering run at the Vortex> prompt, or directly from a Unix prompt. Hope it works!
  9. A good way to debug your program is, well, to use the debugger. Insert a call to the breakpoint() function wherever you want to suspend execution of your program. Recompile your program, and rerun it. When the call to breakpoint() is executed, the program will give you the debugging prompt (debug>), and you can use the full capabilities of the Cecil/Diesel debugger/evaluator to interact with your program. In particular, you can type in Cecil or Diesel expressions (depending on which language your program is written in) and see their values. Moreover, you can type in (or paste) the methods or functions you want to add (or replace) to your program, and they will be available to you without recompiling the program. Similarly, you can add variable declarations. Press Ctrl-D to exit the debugger (or type help for more options).  The print_line operation, which takes a string argument and prints it, followed by a newline, is another handy, low-tech debugging tool.  At the the debug> prompt, there is also the ability to set breakpoints on entry to methods (break), to step to the next message send (stepping into (step) or over (next) called methods), and to continue execution until the current method returns (finish). See How to Use the Vortex Compiler for more details on the Cecil/Diesel debugger.
  10. The way the evaluator prints out values is by sending them the print_string message. By convention, this message returns a string that's a printable representation of its argument, but does not print anything itself. The debugger then prints that string out. So if you define new kinds of objects/classes in your program, you may also want to define the print_string methods so they print out nicely. Here's an example (in Cecil syntax; Diesel replaces @: with @):

    method print_string(p@:pair[`A,`B]):string {
     "(" || p.first.print_string || "," || p.second.print_string || ")" } 

    Remember that the debug> prompt is printed by your running program (and this is the place to add new methods and evaluate expressions), while the Vortex> prompt is printed by the compiler, and you should only issue compiler commands (like make) at that prompt unless you're debugging Vortex itself.

  11. Once in a while, and certainly before you exit from the Vortex compiler, save a target-program-specific "checkpoint" (the state of Vortex) by entering save. Start your next session by entering load mytest.db if you continue to work with the same program. (See How to Use the Vortex Compiler for details.) Exit the compiler by pressing Ctrl-D.
  12. Hint: you can keep Vortex running while you debug and edit your program; you don't need to exit Vortex after each make.

Windows

If you want to run the Cecil or Diesel interpreter on a UW CSE Windows machine, you can use the standard Windows command window and just invoke the interpreter directly:

> o:\cse\courses\misc_lang\vortex\Cecil\bin\winnt\cecil

or

> o:\cse\courses\misc_lang\vortex\Diesel\bin\winnt\diesel

(This assumes that your o: drive is mapped to \\ntdfs\cs, which is the default for CSE machines.)

If you want to run the Vortex compiler, then you need to set things up a bit first:

Manuals

Look at the following for details about Cecil, Diesel, and Vortex:

Emacs modes

To use them, put them in some directory, e.g. ~/emacs, and then add lines like the following to your ~/.emacs file:

(setq load-path (cons (expand-file-name "~/emacs") load-path))
(autoload 'cecil-mode "cecil-mode" "Cecil mode" t)
(autoload 'diesel-mode "diesel-mode" "Diesel mode" t)
(setq auto-mode-alist (cons '("\\.cecil$" . cecil-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.diesel$" . diesel-mode) auto-mode-alist))

More Info

For more info consult the Cecil/Vortex Home Page.

Mail us your feedback!


Cecil/Vortex Project