Language.Copilot.Analyser
Description
This module provides a way to check that a Copilot specification is compilable
- check :: StreamableMaps Spec -> Maybe Error
- data Error
- = BadSyntax String Var
- | BadDrop Int Var
- | BadPArrSpec Var Ext String
- | BadType Var Var
- | BadTypeExt Ext Var
- | NonNegativeWeightedClosedPath [Var] Weight
- | DependsOnClosePast [Var] Ext Weight Weight
- | DependsOnFuture [Var] Ext Weight
- data SpecSet
- = AllSpecSet
- | FunSpecSet
- | DropSpecSet
- | PArrSet
- getExternalVars :: StreamableMaps Spec -> [Exs]
Main error checking functions
check :: StreamableMaps Spec -> Maybe ErrorSource
Check a Copilot specification.
If it is not compilable, then returns an error describing the issue.
Else, returns Nothing
Used for representing an error in the specification, detected by check
Constructors
| BadSyntax String Var | the BNF is not respected |
| BadDrop Int Var | A drop expression of less than 0 is used | BadSamplingPhase Var Ext -- ^ if an external variable is sampled at phase -- 0 then there is no time for the stream to be -- updated | BadSamplingArrPhase Var Ext -- ^ if an external variable is sampled at -- phase 0 then there is no time for the -- stream to be updated |
| BadPArrSpec Var Ext String | External array indexes can only take variables or constants as indexes. |
| BadType Var Var | either a variable is not defined, or not with the good type ; there is no implicit conversion of types in Copilot |
| BadTypeExt Ext Var | either an external variable is not defined, or not with the good type; there is no implicit conversion of types in Copilot |
| NonNegativeWeightedClosedPath [Var] Weight | The algorithm to compile Copilot specification can only work if there is no negative weighted closed path in the specification, as described in the original research paper |
| DependsOnClosePast [Var] Ext Weight Weight | Could be compiled, but would need bigger prophecyArrays |
| DependsOnFuture [Var] Ext Weight | If an output depends of a future of an input it will be hard to compile to say the least |
Varied other things
getExternalVars :: StreamableMaps Spec -> [Exs]Source