Skip to content

Dinnerbone/Rascal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

290 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rascal

License

Rascal is an open source ActionScript 2 compiler, with aspirations for further ActionScript and SWF editing capabilities in the future.

It was primarily developed for use with Ruffle, and allows the authoring and editing of ActionScript 1 and 2 content without the need to hunt down a copy of Flash from eBay.

Command Line Usage

A basic CLI is provided for compiling ActionScript files to SWF files.

Installation

  • Clone the repository
  • Run cargo install --path crates/cli --release

Usage

For full CLI usage, run rascal --help.

There are two kinds of inputs, and they are intermixable.

  • rascal foo.as - Compiles a script (not a class, loose code) into a SWF file.
    • Multiple script files can be specified, and they will execute in the order they are specified.
  • rascal -c some.ClassName - Compiles a class named some.ClassName (expected to be available at some/ClassName.as) into a SWF file.
    • The classpath defaults to working directory, but can be specified via the --classpath flag.
    • Multiple class names can be specified, and they will be loaded in the order they are specified.
    • If one (and only one) class has a static function main(), it will be executed as the entry point to the swf.

Various options about the output are available:

  • -o foo.swf/--output foo.swf - The output SWF file
    • This defaults to either the first script file + .swf, else output.swf
  • -v 10/--swf-version 10 - The version of SWF file to produce
  • --frame-rate 30 - The frame rate of the SWF file
    • This defaults to 24

Library

Super simple API right now:

use rascal::ProgramBuilder;
use rascal::provider::FileSystemSourceProvider;
fn main() {
    // A source provider is responsible for resolving files during compilation.
    // A file system source provider is provided for convenience, which takes a root directory as a "class path".
    let source_provider = FileSystemSourceProvider::with_root(PathBuf::from("."));
    let program = ProgramBuilder::new(source_provider)
        .add_script("foo.as") // Adds `foo.as` as a script to run
        .add_class("some.ClassName") // Adds `some/ClassName.as` as a class to load
        .build()?;
    let compiled_program = program.compile(/* swf_version= */ 15);
    let swf = compiled_program.to_swf(/* frame_rate= */ 24.0)?;
    // Do something with the SWF file.
}

License

Rascal is licensed MIT or Apache-2.0, at your option.

About

Rust ActionScript Compiler (and linker, technically).

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages