jeffreyguenther / shiro

Shiro - a declarative, dataflow programming language for exploring alternatives
MIT License
16 stars 2 forks source link

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.

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 shiro-lang@googlegroups.com 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.

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: shiro-lang@googlegroups.com

License

Shiro is licensed under the MIT license