Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.
/ shiro Public archive

Shiro - a declarative, dataflow programming language for exploring alternatives

License

Notifications You must be signed in to change notification settings

jeffreyguenther/shiro

Repository files navigation

Shiro

Shiro is a dataflow programming language designed to be embedded into applications to help to support reuse and the exploration of alternatives. The language is part of Jeff's PhD thesis. This is research code. Use with a sense of humour and lots of patience.

Usage

The Shiro runtime is designed to be used as the computational engine for applications like parametric CAD tools, vector editors, and spreadsheets. The runtime provides an API to modify a program.

A Quick Sample

Here's an example that describes a pool with three alternatives layouts:

node Layout begin
  input width Double
  output length Double
end

node Pool[basin] begin
  option singleLane Layout(width: 10.0, length: 30.0)
  option basin Layout(width: 20.0, length: 20.0)
  option olympic Layout(width: 25.0, length: 30.0)
end

node Box begin
  input length Double
  input width Double
  input height Double
  output volume Double( length * width * height)
end

node Cost begin
  input volume Double
  output cost Double(volume * 12.0)
end

graph poolCosts begin
  pool Pool
  b Box(length: pool.active.length, width: pool.active.width, height: 10.0)
  c Cost(b.volume)
end

state singleLane begin
  graph poolCosts
  pool[singleLane]
end

state basin begin
  graph poolCosts
  pool[basin]
end

state olympic begin
  graph poolCosts
  pool[olympic]
end

Examples

In examples, you'll find folders with example Shiro programs. Checked examples run in Shiro Playground.

  • Color_Schemes - shows how to create a color scheme

    • ColorScheme_OnColor.sro creates alternatives on individual colors
    • ColorScheme_OnScheme.sro creates alternatives on the entire scheme
  • Data_Analysis - example of processing a CSV file and viewing the result in a table

    • poverty.sro analysis of the world's population in poverty
  • Drawing - shows how to draw in Shiro

    • Costume_Selection.sro shows how to render differty costumes for a character
    • FlowerOfLife.sro uses traces of the Flower of Life, a patterns of circles to create images
    • shapes.sro is collage of the shapes you can draw in Shiro
  • Finance - financial calculations

    • compund_interest.sro demonstrates CompoundInterest node
    • Investment.sro shows how to compare two investment products
  • Logo - create alternative versions of a logo

    • 'EverClean_logo.sro' defines a design for a logo
  • Old_Examples - examples written in the old syntax to be ported

  • Syntax_Examples - short snippets demonstrating bits of the syntax

    • Includes - demonstrates the use of include
    • Options - desmonstrates the use of option
    • Recursion - demonstrates how to do recursion
    • arthimetic.sro demonstrates basic arithmetic
    • list.sro syntax for a literal list
    • map.sro demonstrates how to use the map function to iterate over a list.

Integrating Shiro

Shiro is designed to be integrated into applications as a scripting language. See the Playground for an example of what it takes.

The latest version of Shiro is 0.5.0

Add via maven

Group ID Artifact ID Version
org.shirolang shiro 0.5.0

Add manually

To add Shiro to your project manually, add the fat jar to the classpath of your application.

Development

Shiro is implemented in Java. Gradle is used as the build system and dependency manager. The interpreter depends on ANTLR 4.5 to generate the parser, lexer and parse tree event listeners. build.gradle is setup to automatically generate the Java code at compile time. You can use gradle from the commandline or use your favourite Java IDE. The awesome ANTLR plugin for IntelliJ makes it an easy choice.

You can start the Shiro Playground application that allows you to load and run Shiro code using this command:

$ gradle run

Currently, you cannot run execute Shiro code from the commandline. If a REPL is a priority for you, add an issue and we can explore what it will take to make one.

To create an executable for your OS, use the javafx-gradle plugin:

$ gradle jfxDeploy

The executable bundle will be found in build/distributions/bundles

A helpful command to remember if you just want to regenerate the parser, lexer, and base listener is:

$ gradle generateGrammarSource

Questions can be sent to [email protected] or Jeff. If you have taken the time to play with the language, please drop me a line and let me know what you think.

Ways You Can Help

Because this code is being developed for my thesis, I'm responsible for its design and implementation. That said, there are ways you can help give the language the polish it is needed.

  • Give feedback on both the implementation and the language syntax

  • Help write functions for the standard library

    This is one of the biggest and most important parts of the project after the basic language design is complete. We need a good library of multi-functions to make the language helpful to people in a variety of domains.

Acknowledgements

This project is the result of research being conducted at Simon Fraser University's School of Interactive Arts and Technology in the CZSaw Research Group and the Computational Design Group.

People

Mailing list: [email protected]

License

Shiro is licensed under the MIT license

About

Shiro - a declarative, dataflow programming language for exploring alternatives

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages