Skip to main content

Module parser

Module parser 

Source
Expand description

Parser module for the Fiducia language

This module provides parsers for Fiducia language files:

  • .fis files: System description (memory regions, protection domains, channels)
  • .fi files: Program implementation (imports, mappings, IRQs)

§Module Organization

  • [allocator]: Virtual address and channel ID allocation
  • data: Data-layer grammar (struct/const declarations), shared by the .fis and .fi surfaces
  • expr: Expression grammar
  • lexer: Shared lexer primitives (keywords, tokens, identifiers, comments)
  • program: Grammar rules for .fi files
  • statement: Statement grammar (variable declarations, assignments, calls)
  • system: Grammar rules for .fis files, including channel and data-layer (struct/const) declarations — all top-level .fis items
  • types: Type expression grammar and information flow security label keywords
  • crate::ast: AST node type definitions
  • crate::error: Compiler diagnostics with source-annotated rendering

§Examples

Parse a system description (.fis):

let system = fic::parser::parse_system("ProtectionDomain pd1(100);").unwrap();
assert_eq!(system.protection_domains.len(), 1);

Parse a program implementation (.fi):

let program = fic::parser::parse_program(r#"import "eth.c" as eth;"#).unwrap();
assert_eq!(program.imports.len(), 1);

Re-exports§

pub use crate::error::format_errors;
pub use crate::error::Diagnostic;
pub use crate::error::Diagnostics;
pub use crate::foreign::parse as parse_foreign;
pub use lexer::identifier;
pub use lexer::keyword;
pub use lexer::reserved;
pub use lexer::symbol;
pub use lexer::ws;
pub use lexer::Input;
pub use lexer::PResult;
pub use expr::parse as parse_expr;
pub use statement::parse as parse_statement;
pub use types::parse as parse_types;
pub use types::security_label;
pub use types::typed_param;
pub use event::parse as parse_event;
pub use event::parse_evt_decl;
pub use process::parse as parse_process;
pub use program::parse as parse_program;
pub use system::parse as parse_system;

Modules§

event
Parser for Fiducia events.
expr
Expression AST nodes and parser for the Fiducia expression language.
lexer
Lexer primitives and keywords for the Fiducia language.
process
Parser for Fiducia processes.
program
Parser for Fiducia Program Implementation (.fi) files.
statement
Parser for Fiducia statements.
system
Parser for Fiducia System Description (.fis) files.
types
Parser for the Fiducia type grammar and information flow security labels.