A compiler API for the SunScript language. Forked from https://github.com/JoshuaMKW/ssc
Find a file
2015-12-10 22:07:31 -05:00
ast Added increment/decrement operators. 2015-12-10 21:45:35 -05:00
cmdline frontend Added DataCount property to sunCompilerResults. 2015-12-10 17:16:56 -05:00
.gitignore Added batch files for testing and generating grammar classes. 2015-12-07 10:04:03 -05:00
AssemblyInfo.cs Added code so far. 2015-12-06 23:15:02 -05:00
compiler.cs Added DataCount property to sunCompilerResults. 2015-12-10 17:16:56 -05:00
context.cs Fixed: dispose the script streams once they exit. 2015-12-10 17:53:00 -05:00
data table.cs Added code so far. 2015-12-06 23:15:02 -05:00
exceptions.cs Added: new import resolver system which allows for custom user import resolving. 2015-12-08 20:11:35 -05:00
generate.bat Added batch files for testing and generating grammar classes. 2015-12-07 10:04:03 -05:00
grammatica-1.6.dll Added Grammatica DLL and JAR files. 2015-12-06 23:15:42 -05:00
grammatica.jar Added Grammatica DLL and JAR files. 2015-12-06 23:15:42 -05:00
import resolver.cs Fixed: dispose the script streams once they exit. 2015-12-10 17:53:00 -05:00
language.md Added increment/decrement operators. 2015-12-10 21:45:35 -05:00
loop stack.cs Added code so far. 2015-12-06 23:15:02 -05:00
parse.bat Added batch files for testing and generating grammar classes. 2015-12-07 10:04:03 -05:00
parser.cs Added increment/decrement operators. 2015-12-10 21:45:35 -05:00
readme.md Made links to language.md. 2015-12-10 22:07:31 -05:00
scope stack.cs Added code so far. 2015-12-06 23:15:02 -05:00
sunscript.grammar Added increment/decrement operators. 2015-12-10 21:45:35 -05:00
symbol table.cs Added code so far. 2015-12-06 23:15:02 -05:00
tokenize.bat Added batch files for testing and generating grammar classes. 2015-12-07 10:04:03 -05:00
writer.cs Added code so far. 2015-12-06 23:15:02 -05:00

ssc

Summary

ssc is a basic, work-in-progress compiler for SunScript. It supports all of the byte-code functionality of Super Mario Sunshine's SPC interpreter. The compiler compiles to the SPC binary format (.sb files) used by Super Mario Sunshine.

This program utilizes the Grammatica library to generate an LL(k) parser using a grammar syntax file.

Usage

To use ssc, create an instance of the sunCompiler class. Use the sunCompiler.Compile or any of its overloads to compile a script:

Parameter Description
name The name of the main script to compile. This is passed to the import resolver.
output The output stream into which the compiled binary file will be written.
resolver An instance of the import resolver to use. If not specified, sunImportResolver.Default will be used.

ssc by default resolves imports by loading files on disk (see language.md. for more information). To use a custom import resolver, create a new class inheriting from sunImportResolver and pass an instance of it to the sunCompiler.Compile method.

The result of compilation will be returned in a sunCompilerResults instance. Use the various properties on this type to gather the information of the compilation:

Property Description
Success Whether the script was compiled successfully. If not, the Error property should be non-null.
Error The fatal error which occured during compilation. If compilation was successful, this should be null.
CompileTime The time it took to compile, measured as a TimeSpan instance.
DataCount The total number of data-table entries created.
SymbolCount The total number of symbols (builtins, functions, and variables) created.
BuiltinCount The total number of builtin symbols created.
FunctionCount The total number of function symbols created.
VariableCount The total number of global-scope variable symbols created.

If the error is of the type sunScriptException, you can cast and retrieve the script name, line, and column of the error.

Language

For more information on the SunScript language and its syntax, see language.md.