Ocelot Compiler

I have written my own compiler for the CPU-A family. The compiler allows you to write in simple language which resembles a combination of Perl and C. Please note that the compiler doesn't allow you to download code to your unit, you'll have to use C-MAX to do that.

Current Status

This compiler is still under development. I have done quite a bit of testing, but I am not finished. I'm still open to suggestions on how to improve the language. I'm also looking for any volunteers to help get this running under Windows. :-)

Documentation

I've started to write a user manual for the compiler. You can get it from here. If anyone would like to volunteer to help with this, I would be forever in your debt. :-)

Download

Date Binaries Source Notes
05-28-2002 Linux (RH 7.3)
Solaris (2.8)
DOS
ocelot-2.10b4.tar.gz

Summary of changes since the previous release (see Changelog for more info):
  • Modified touch_button_pressed so it takes a button number up to 2059
  • Fixed bug which caused oclc to dump core if you used the same symbol name for a variable and a timer
  • Fixed bug in ocld when decoding variable numbers
  • Updated the ocelot instruction format doc: updated time_of_day to add variable definition
  • IMPORTANT SYNTAX CHANGE!!!! I changed:

    transmit_ascii_string(MESSAGE_NO);

    to:

    transmit_ascii_message(MODULE_NO, MESSAGE_NO_or_VARIABLE);
  • Added examples directory (currently contains my pitiful program, other donations of examples would be happily accepted). :-)
  • Patrick Hurley submitted the following patches/enhancements:
    • added ability to use a variable name as a parameter to the transmit_ir() and transmit_ascii_message() functions
    • fixed a few bugs in ocld (source code decompile was still putting out "Variable# " some times instead of "variable_")
  • ocld forgot a trailing ";" on several of the statements when the "-s" option was specified (Steve Hazelett)
  • Added the evaluation of constant expressions. Floating point arithmetic is done on the entire expression, then it is truncated when the evaluation is finished (since the ocelot can only deal with integers). Now you can do thinks like:

    constant a = (61*31)/3 + (1+1+1)/4; # this evaluates to 631

    if (mytimer > (60 * 60)) { # if (mytimer > 3600) {

    Thanks to Dan Butterfield for this idea.
  • Added more allowable characters to the variable name (must still begin with an alpha character). Added: + - .
  • Added a new command "alias". This will allow you to alias any of the command statements to a new name (now you can make some really cryptic programs :-). Everything except 'include', '"', '(', ')', '{', '}', ';', '#' and '//' can be aliased. For example:

    alias a = "alias"; a c = "constant"; a i = "if";
    a t = "time_of_day"; a m = "module_point"; a l = "<"; c
    z = "R-20"; c q = "2/3"; c o = "Turns Off";

    i (t l z) { m(q, o); }

    Which translates to:

    if (time_of_day < "R-20") { module_point("2/3", "Turns Off"); }
  • IMPORTANT SYNTAX CHANGE!!!! I changed the load_data_to parameter from a number to a variable name (which is what it should have been).
  • Added ability for the following "if" statements to compare against a variable number:
    • module param
    • compare bobcat data
    • timer
    • variable
    • time of day
    • month
    • day of month
    • day of week
    • year
  • Added the ability to set a timer or variable equal to another variable
  • Added (and updated) the Ocelot instruction format doc
  • Added "%option noyywrap" (thanks to Scott Grosch)
  • Changed reserved variable definition meaning. Now all it is used for is to warn the user that they are using a reserved variable.
07-26-2001 RH Linux 7.1
Solaris 2.7
DOS
ocelot-2.02.tar.gz

Summary of changes since the previous release (see Changelog for more info):
  • released ocelot-2.02
  • Changed reserved variable definition to be between 59 and 62 since 63 is used for the Leopard screen number) -- thanks to Ken Mitchell.
  • changed version to 2.01 (but didn't release it)
  • fixed bugs in oclc.y:
    • set_slave_variable wasn't dealing with "leopard" correctly (it was always set to "ocelot" even if you said "leopard")
    • module/points in constants could get overwritten, causing oclc to core dump
06-13-2000 RH Linux 6.2
Solaris 2.7
DOS
ocelot-2.00.tar.gz This is a new version which supports the latest cpuxa executive (1.61d).

Summary of changes since the previous release (see Changelog for more info):
  • Changed macro parameter types to be: "number" (if it's a numeric constant) "string" (if it's a string constant) "variable" (if it's the name of a variable)
  • Added new IF command:
    • bobat_data()
  • Added 4 new THEN commands:
    • set_slave_variable();
    • load_data_to();
    • send_rcs_x10();
    • send_bobcat_thermostat();
  • Changed the x10_status_change() and module_point() commands to include the status as a parameter to the commands (i.e., x10_status_change("A/1", Turns_on)). Also changed the status from a number to a string.
04-24-2000 RH Linux 6.1
Solaris 2.7
DOS
ocelot-1.00.tar.gz This is the first official release.

There have been no changes since the previous (2nd beta) release, except to update the version number to 1.0.
04-04-2000 RH Linux 6.1
Solaris 2.7
DOS
ocelot-0.91.tar.gz This is the 2nd beta release.

Changes since the previous release:
  • oclc now exits after a fatal error
  • Added constants for True (1), False (2) and Unset (0)
  • Added constants for Month (January, February, etc...) and Day-of-week (Sunday, Monday, etc...). Thanks to Vince Goddard.

Sample Programs

Here are some sample programs to get you started. If you use any of these programs, no one is responsble for any problems you may have, and I mean no one. :-)

DateSourceAuthorNotes
04-24-2000 David Alden tests.tar.gz This file includes the test programs that I used for testing the compiler. Note that they are included with the source distribution.
04-24-2000 Mark Day cabin.tar.gz This file includes the control program for Mark's cabin. :-) It's a good example of how to breakup your code between various include files.