subscript: a process algebra extension progress and perspectives

17
SubScript: A Process Algebra extension progress and perspectives Anatolii Kmetiuk Andre van Delft

Upload: anatolii-kmetiuk

Post on 22-Jan-2018

327 views

Category:

Software


2 download

TRANSCRIPT

Page 1: SubScript: A Process Algebra extension progress and perspectives

SubScript: A Process Algebra extension

progress and perspectives

Anatolii Kmetiuk Andre van Delft

Page 2: SubScript: A Process Algebra extension progress and perspectives

Plan

• Introduction of the language

• Examples and features available

• Future development

Page 3: SubScript: A Process Algebra extension progress and perspectives

Introduction of the language

Page 4: SubScript: A Process Algebra extension progress and perspectives

Meet SubScript

• An extension to Scala programming language

• Adds a syntax for process description inspired by the Algebra of Communicating Processes

• Aims for simplification of event-driven and concurrent programming

Page 5: SubScript: A Process Algebra extension progress and perspectives

Brief history• Started as a library (VM), then the syntax was added by a compiler fork - it was difficult to

get started

• Developed into a preprocessor based on parser combinators to specify the syntax. It is managed by an SBT plugin - easy to get started and play with the syntax

scalaVersion := "2.11.7"libraryDependencies += "org.subscript-lang" %% "subscript-swing" % "3.0.3"SubscriptSbt.projectSettings

addSbtPlugin("org.subscript-lang" %% "subscript-sbt-plugin" % "3.0.3")

build.sbt

project/build.sbt

Page 6: SubScript: A Process Algebra extension progress and perspectives

Examples and features available

Page 7: SubScript: A Process Algebra extension progress and perspectives

Example: Hello World

import subscript.languageimport subscript._import subscript.Predef._

object Main extends SubScriptApplication {

script live = println("Hello") println("World")

}

Short

Verbose import subscript.language

import subscript._import subscript.Predef._

object Main {

def main(args: Array[String]): Unit = runScript(live)

script live = {:println("Hello"):} {:println("World"):}}

Page 8: SubScript: A Process Algebra extension progress and perspectives

Operators• Sequential: space, line break, “;” - identical

• Parallel: &&, &, ||, | - behaviour inspired by Boolean logic

• Choice: “+” operator selects between its operands

• Disruption: “/“ - left hand side disrupted by the right hand side

• Conditional: if-then-else (boolean script result values as a predicate), do-then-else (script success status as a predicate)

Page 9: SubScript: A Process Algebra extension progress and perspectives

Data Flow• Each script can have a result value, it can be set

with a special syntax

• The result value can be processed using the dataflow notation

script.. live = msg ~~(message: String)~~> println(message) msg = ^"Hello World"

Page 10: SubScript: A Process Algebra extension progress and perspectives

Example application: Eye Testobject Main extends SubScriptApplication {

script.. live = initGui [ new WaitScreen || initData^ ]~~(repos: Repositories)~~> [ new MainScreen(repos); let repos.close()]

initGui = javax.swing.UIManager.setLookAndFeel: "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"

initData = ^{*new DerbyRepo("eyetest-db")*}}

Page 11: SubScript: A Process Algebra extension progress and perspectives

Example application: Eye Test

class Test extends Frame with FrameProcess {

script..

live = mainTestProcess^ / cancelBtn

mainTestProcess = eyeTest("Right")^^1 eyeTest("Left" )^^2

eyeTest(eyeName: String) = let testArea.font = new Font("Ariel", ..., 20) let testArea.text = s"Look with $eyeName eye, OK when ready" let answerField.enabled = false sleep: 250 Key.Enter + okBtn doTest( if(eyeName=="Right") previousScoreRight else previousScoreLeft )^}

Page 12: SubScript: A Process Algebra extension progress and perspectives

Future development

Page 13: SubScript: A Process Algebra extension progress and perspectives

Perspective directions

• User-computer interactions specification

• Prototyping & implementing the behaviour of consumer electronics:TV, cooking plates, ...

• Simulation & verification: railroad interlocking

• SubScriptJS: run in web browser; improve NodeJS

• Preprocessor: ScalaParse & Dotty

Page 14: SubScript: A Process Algebra extension progress and perspectives

https://github.com/scala-subscript/koans

Getting Started: Koans

Page 15: SubScript: A Process Algebra extension progress and perspectives

Getting Started: Cheat Sheet

https://www.cheatography.com/anatoliykmetyuk/cheat-sheets/subscript/

Page 16: SubScript: A Process Algebra extension progress and perspectives

Getting Started: Homepage

• GitHub: https://github.com/scala-subscript/subscript

• Official website: http://subscript-lang.org/

Page 17: SubScript: A Process Algebra extension progress and perspectives

Thank you for your attention!