We can infer span information when needed by the user using the knowledge conveyed by the semantic rules.
Let's say we have an expression e > f, if the type signature of f is T -> U we can inspect the type T. If T = Span<T'> and if e = T' then we can conclude the semantic action expect the data to be englobed inside a span. We can recursively inspect the type of the semantic action and add span when needed along the way.
We thus need to rely on a type Span proper to Oak but the user is still allowed to convert Oak-span into its own version inside the semantic action.
We can infer span information when needed by the user using the knowledge conveyed by the semantic rules.
Let's say we have an expression
e > f
, if the type signature off
isT -> U
we can inspect the typeT
. IfT = Span<T'>
and ife = T'
then we can conclude the semantic action expect the data to be englobed inside a span. We can recursively inspect the type of the semantic action and add span when needed along the way.We thus need to rely on a type
Span
proper to Oak but the user is still allowed to convert Oak-span into its own version inside the semantic action.