From ccdde14cb16bdee446c6ee3f866d52478c09eef3 Mon Sep 17 00:00:00 2001 From: Erle Czar Mantos Date: Thu, 21 Jul 2016 14:58:54 +0800 Subject: [PATCH] Fixes #253 - Update DSL Grammar. Signed-off-by: Erle Czar Mantos --- website/UpdatesOnTheDSL.md | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 website/UpdatesOnTheDSL.md diff --git a/website/UpdatesOnTheDSL.md b/website/UpdatesOnTheDSL.md new file mode 100644 index 0000000000..4e882db896 --- /dev/null +++ b/website/UpdatesOnTheDSL.md @@ -0,0 +1,73 @@ +## Improvements to the Vorto DSL + +### Description on operation Parameters: + +Now you can add descriptions for each operation parameters. Example: + +``` +operations { + drive(leftWheelSpeed as float "Speed of left wheel", rightWheelSpeed as float "Speed of right wheel") returns boolean +} +``` + +### Constraint on operation parameters and return type: + +Previously, you can only specify constraints on properties. Now you can also specify them on operation parameters and return types. Example: + +``` +operations { + move(leftWheelSpeed as float , rightWheelSpeed as float ) "Moves the wheels" + currentMotorHeat() returns float "Returns the current motor heawt" +} +``` + +### Function block can now inherit from another function block +Previously, you can only specify inheritance relationship on Datatypes. Now you can also specify it in Function blocks. +``` +functionblock DifferentDriveWithSkidWheel extends com.mycompany.fb.DifferentialDrive { +``` + +### Measurement Unit, Readable, Writeable, Eventable + +You can specify a measurement unit for any properties that you add. You can also specify if they are readable, writeable +or eventable. + +Example: + +``` +status { + mandatory motorHeat as float with { measurementUnit : Temp.Celsius, readable : true, writable : true, eventable : false } +} +``` + +### Breakable: + +You can also specify if an operation in your function block can throw an error by specifying it as +breakable, like so: + +``` +operations { + move(leftWheelSpeed as float,rightWheelSpeed as float) + breakable forward() + backward() + breakable turn(angle as float) +} +``` + +### Dictionary Type: + +One of the constant request is to add a Dictionary type to Vorto. We have finally added it. + +``` +using com.mycompany.type.Color ; 1.0.0 + +entity ColorLookupTable { + mandatory redLookupTable as Dictionary [ string , int ] + mandatory greenLookupTable as Dictionary [ string , int ] + mandatory blueLookupTable as Dictionary [ string , int ] + mandatory hueLookupTable as Dictionary + mandatory property1 as Dictionary [ string , Color ] + mandatory property2 as Dictionary [ string , Dictionary ] + mandatory property3 as Dictionary [ string , Dictionary [ int, Color ] ] +} +```