pub struct LanguageProfile {
pub symbol: Symbol,
pub reader: Symbol,
pub lowering: Symbol,
pub eval_policy: Symbol,
pub organs: Vec<OrganUse>,
pub numeric_tower: Option<Symbol>,
pub capabilities: Vec<CapabilityName>,
pub unsupported_forms: Vec<Symbol>,
pub conformance_tests: Vec<Symbol>,
pub fidelity_badges: Vec<FidelityBadge>,
}Expand description
A language profile: the reader, lowering, eval-policy, organs, and metadata
that present one surface language over the shared Expr graph.
Profiles are the unit the standard distribution installs, diffs, and tests;
the per-language sim-lib-lang-* crates build one each.
§Examples
use sim_kernel::Symbol;
use sim_lib_standard_core::{LanguageProfile, OrganUse, standard_control_organ_symbol};
let profile = LanguageProfile::new(Symbol::qualified("lang", "demo/v1"))
.with_reader(Symbol::qualified("codec", "lisp"))
.with_eval_policy(Symbol::qualified("eval", "default"))
.with_organ(OrganUse::new(standard_control_organ_symbol()));
assert_eq!(profile.reader, Symbol::qualified("codec", "lisp"));
assert_eq!(profile.organs.len(), 1);Fields§
§symbol: SymbolSymbol naming the profile.
reader: SymbolReader (codec) symbol the profile parses with.
lowering: SymbolLowering symbol mapping surface forms onto the shared graph.
eval_policy: SymbolEval-policy symbol the profile evaluates under.
organs: Vec<OrganUse>Organs the profile uses.
numeric_tower: Option<Symbol>Optional numeric tower symbol.
capabilities: Vec<CapabilityName>Capabilities the profile requires.
unsupported_forms: Vec<Symbol>Surface forms the profile does not support.
conformance_tests: Vec<Symbol>Conformance tests covering the profile.
fidelity_badges: Vec<FidelityBadge>Fidelity badges declared for the profile.
Implementations§
Source§impl LanguageProfile
impl LanguageProfile
Sourcepub fn new(symbol: Symbol) -> Self
pub fn new(symbol: Symbol) -> Self
Start a profile named symbol with unspecified reader/lowering/eval-policy
and no organs.
Sourcepub fn with_reader(self, reader: Symbol) -> Self
pub fn with_reader(self, reader: Symbol) -> Self
Set the reader symbol.
Sourcepub fn with_lowering(self, lowering: Symbol) -> Self
pub fn with_lowering(self, lowering: Symbol) -> Self
Set the lowering symbol.
Sourcepub fn with_eval_policy(self, eval_policy: Symbol) -> Self
pub fn with_eval_policy(self, eval_policy: Symbol) -> Self
Set the eval-policy symbol.
Sourcepub fn with_organ(self, organ: OrganUse) -> Self
pub fn with_organ(self, organ: OrganUse) -> Self
Add an organ use.
Sourcepub fn with_numeric_tower(self, numeric_tower: Symbol) -> Self
pub fn with_numeric_tower(self, numeric_tower: Symbol) -> Self
Set the numeric tower symbol.
Sourcepub fn requiring(self, capability: CapabilityName) -> Self
pub fn requiring(self, capability: CapabilityName) -> Self
Add a required capability.
Sourcepub fn with_unsupported_form(self, form: Symbol) -> Self
pub fn with_unsupported_form(self, form: Symbol) -> Self
Add an unsupported surface form.
Sourcepub fn with_conformance_test(self, test: Symbol) -> Self
pub fn with_conformance_test(self, test: Symbol) -> Self
Add a conformance test.
Sourcepub fn with_fidelity_badge(self, badge: FidelityBadge) -> Self
pub fn with_fidelity_badge(self, badge: FidelityBadge) -> Self
Add a fidelity badge.
Sourcepub fn to_constructor_args(&self) -> Vec<Expr>
pub fn to_constructor_args(&self) -> Vec<Expr>
Encode this profile as constructor arguments for the standard/Profile class.
Sourcepub fn from_constructor_args(args: Vec<Expr>) -> Result<Self>
pub fn from_constructor_args(args: Vec<Expr>) -> Result<Self>
Decode a profile from standard/Profile constructor arguments.
Trait Implementations§
Source§impl Clone for LanguageProfile
impl Clone for LanguageProfile
Source§fn clone(&self) -> LanguageProfile
fn clone(&self) -> LanguageProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LanguageProfile
impl Debug for LanguageProfile
impl Eq for LanguageProfile
Source§impl PartialEq for LanguageProfile
impl PartialEq for LanguageProfile
Source§fn eq(&self, other: &LanguageProfile) -> bool
fn eq(&self, other: &LanguageProfile) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LanguageProfile
Auto Trait Implementations§
impl Freeze for LanguageProfile
impl RefUnwindSafe for LanguageProfile
impl Send for LanguageProfile
impl Sync for LanguageProfile
impl Unpin for LanguageProfile
impl UnsafeUnpin for LanguageProfile
impl UnwindSafe for LanguageProfile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.