Skip to main content

fic/ast/
mod.rs

1//! The AST: the nodes the parsers produce for a `.fis` (the system
2//! description) and a `.fi` (a protection domain's program), one file per
3//! node family, flat-re-exported here, and [`RawAst`], the project: the
4//! one node over both, so neither file imports the other. `parser/`
5//! depends on this module, never the reverse.
6
7use serde::Serialize;
8
9pub mod channel;
10pub mod data;
11pub mod event;
12pub mod expr;
13pub mod infoflow;
14pub mod process;
15pub mod program;
16pub mod statement;
17pub mod system;
18pub mod types;
19
20pub use channel::{ChannelBuffer, ChannelDecl, ChannelKind};
21pub use data::{ConstDecl, DataDecl, StructDecl, StructField};
22pub use event::{CommKind, Event, EvtDecl, IrqKind};
23pub use expr::{BinaryOp, CExpr, Expr, ExprKind, Lit, UnaryOp};
24pub use infoflow::SecurityLabel;
25pub use process::{BindAnnotation, Process, ProcessDecl};
26pub use program::{EntryBinding, Import, MappingDecl, Program};
27pub use statement::{Assign, Dbg, DbgArg, Statement, VarDecl};
28pub use system::{MemoryRegionDecl, ProtectionDomainDecl, System, SystemDecl};
29pub use types::{
30    Address, ArraySize, InvalidPageSize, InvalidPermission, PageSize, Permission, PrimitiveType,
31    Type,
32};
33
34/// A parsed project: the `.fis` system description and its programs, one
35/// per protection domain.
36///
37/// Produced by [`crate::frontend::parse_sources`], which binds each PD to
38/// its `.fi` (`eth_outer.fi` implements the PD `eth_outer`).
39#[derive(Debug, Clone, Serialize)]
40pub struct RawAst {
41    /// The system description AST.
42    pub system: System,
43    /// Each protection domain's program, `programs[i]` implementing
44    /// `system.protection_domains[i]`.
45    pub programs: Vec<Program>,
46}