pub struct Workspace {
    pub components: Vec<ComponentDef>,
    pub declarations: Vec<ComponentDef>,
    pub lib: LibrarySignatures,
    pub original_imports: Vec<String>,
    pub metadata: Option<String>,
}
Expand description

A Workspace represents all Calyx files transitively discovered while trying to compile a top-level file.

Example

When parsing a file foo.futil:

import "core.futil";

component main() -> () { ... }

The workspace gets the absolute path for core.futil and adds main to the set of defined components. core.futil is searched both relative to the current file and the library path. Next core.futil is parsed:

extern "core.sv" {
    primitive std_add[width](left: width, right: width) -> (out: width);
}

The workspace adds std_add to the currently defined primitives and looks for core.sv in a relative path to this file. It does not look for core.sv on the library path.

Finally, since core.futil does not import any file, the parsing process is completed.

Fields

components: Vec<ComponentDef>

List of component definitions that need to be compiled.

declarations: Vec<ComponentDef>

List of component definitions that should be used as declarations and not compiled. This is used when the compiler is invoked with File compilation mode.

lib: LibrarySignatures

Absolute path to extern definitions and primitives defined by them.

original_imports: Vec<String>

Original import statements present in the top-level file.

metadata: Option<String>

Optional opaque metadata attached to the top-level file

Implementations

Construct a new workspace using the compile.futil library which contains the core primitives needed for compilation.

Construct a new workspace from an input stream representing a Calyx program.

Construct the Workspace using the given NamespaceDef and ignore all imported dependencies.

Merge the contents of a namespace into this workspace. is_source identifies this namespace as a source file. The output is a list of files that need to be parsed next and whether they are source files.

Construct the Workspace using the given files and all their dependencies. If SHALLOW is true, then parse imported components as declarations and not added to the workspace components. If in doubt, set SHALLOW to false.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.