Compiling a .sm

These instructions assume that:

The following table explains the default file name and suffix used for each target language supported by SMC. The default file name suffix may be changed by using the -suffix and -hsuffix command line parameters. By default, SMC places the generated file(s) in the current working directory. This may be altered using the -d and -headerd command line parameters.

The following table assumes that the input file is named AppClass.sm:

Target Language Command Line Option Base File Name File Name Suffix Complete File Name
C -c AppClass_sm .h, .c AppClass_sm.h,
AppClass_sm.c
C++ -c++ AppClass_sm .h, .cpp AppClass_sm.h,
AppClass_sm.cpp
C# -csharp AppClass_sm .cs AppClass_sm.cs
Graphviz -graph AppClass_sm .dot AppClass_sm.dot
Groovy -groovy AppClassContext .groovy AppClassContext.groovy
Java -java, -java7 AppClassContext .java AppClassContext.java
Lua -lua AppClass_sm .lua AppClass_sm.lua
Objective-C -objc AppClass_sm .h, .m AppClass_sm.h,
AppClass_sm.m
Perl -perl AppClass_sm .pm AppClass_sm.pm
Php -php AppClass_sm .php AppClass_sm.php
Python -python AppClass_sm .py AppClass_sm.py
Ruby -ruby AppClass_sm .rb AppClass_sm.rb
Scala -scala AppClassContext .scala AppClassContext.scala
HTML table -table AppClass_sm .html AppClass_sm.table
Tcl -tcl AppClass_sm .tcl AppClass_sm.tcl
Visual BASIC .Net -vb AppClass_sm .vb AppClass_sm.vb

The steps to compiling a .sm file are:

  1. From a shell (Unix or Windows CMD), go to the directory containing the .sm file.
  2. $ java -jar $SMC_HOME/bin/Smc.jar [-c | -c++ | -csharp | -graph | -groovy | -java | -java7 | -lua | -objc | -perl | -php | -python | -ruby | -scala | -table | -tcl | -vb] <fsm_source_file>.sm

You must specify one of:

so SMC will know what source code to generate. Failure to do specify exactly one will result in an error and the state machine file will not be compiled.

smc's command line options are: