-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Build the project as to obtain a compiled version of the provider (Sast.dll). You need that in order to reference the type provider. Open Sast.sln in Visual Studio and build the solution.
Prerequisites: NuGet Package Manager for Visual Studio
We use nuget package manager to manage project dependencies. To get NuGet:
In Visual Studio, click Tools/Extension and Updates. Navigate to Tools/Online, then search for "NuGet Package Manager for Visual Studio" and click Download.
If you have a problem with the packages, all needed packages are in packet.references file (Click Manage NuGetPackages from the solution file and install the listed package from there).
There are several option for using the type provider and Scribble.
Option 1: FILE You can give a file containing an fsm obtained from projecting the protocol
Option 2: LocalExecutable You can use local installation of Scribble. In the config file, you need to specify the path to scribble.bat file (that runs the local version of Scribble and returns an fsm, see the example section below). Make sure you have a scribble.bat.
Option: WebAPI You can use the online version of Scribble. You need to start locally a web service that connects to it. Do the following:
- Clone/download https://github.com/Lleutch/ScribbleApi
- From the command line run the command :
.\local.cmd
Prerequisites: curl
Let’s look at the Fibonacci example. You can find it in the Example folder: First, specify the path to the ScribbleGenerativeTypeProvider.dll For example,
#r "../../src/Sast/bin/Debug/Sast.dll"
Then open the type provider module:
open ScribbleGenerativeTypeProvider
Instantiate the Type Provider
type Fib = Provided.TypeProviderFile< "Fib.scr" // Fully specified path to the scribble file,
,"Adder" // name of the protocol
,"C" // local role
,"config.yaml" // config file containing IP and port for each role and the path to the scribble script
,Delimiter=delims // list of labels
,TypeAliasing=typeAliasing // give a mapping from scribble types to F# types
,ScribbleSource = ScribbleSource.LocalExecutable> // choose one of the following options: (LocalExecutable | WebAPI | File)
Use the generated types:
let protocol = new Fib()
let sessionChannel = protocol.Start()