Skip to main content

SymbolTable

Struct SymbolTable 

Source
pub struct SymbolTable { /* private fields */ }

Implementations§

Source§

impl SymbolTable

Source

pub fn register_builtins(&mut self)

Source§

impl SymbolTable

Source

pub fn declare_unbound(&mut self, name: &str)

Keeps the special declaration of name with no value: a DEFVAR of it ran in the unit but nothing bound it. A name the unit started with a value no store replaced keeps that value.

Source

pub fn restore_declaration(&mut self, name: &str, stored: bool)

Puts the declaration of the global name back as it stood before the unit, when no DEFVAR of it ran: a global a store gave a value is then one a SETF created.

Source

pub fn carry(&mut self, name: &str, carried: Carried)

Makes carried the session value of the global name.

Source§

impl SymbolTable

Source

pub fn record_closure_params(&mut self, sig: ClosureSigId, params: &[WasmType])

Records the parameter WasmTypes for a closure signature id (see Self::closure_params).

Source

pub fn closure_params(&self, sig: ClosureSigId) -> Option<&[WasmType]>

The recorded parameter WasmTypes for a closure signature id, or None when the closure wasn’t recorded.

Source

pub fn closure_param(&self, sig: ClosureSigId) -> Option<WasmType>

The recorded first parameter WasmType for a closure signature id, or None when the closure takes no parameters or wasn’t recorded.

Source

pub fn record_closure_body( &mut self, place: Place, params: LambdaParams, body: Expr, )

Records a value-position lambda’s source for the closure value in place.

Source

pub fn closure_body(&self, place: Place) -> Option<&(LambdaParams, Expr)>

The source of the closure value held in place, if one was recorded.

Source

pub fn forget_closure_body(&mut self, place: Place)

Drops the recorded source of place: a setf overwrote the closure, so the source no longer describes the value now there.

Source§

impl SymbolTable

Source

pub fn closure_source(&self, site: i32) -> Option<&ClosureSource>

The source of the closure made at site in the unit that last compiled.

Source§

impl SymbolTable

Source

pub fn define(&mut self, symbol: Symbol)

Defines a symbol: it writes only the cells it carries, so a variable leaves the function of its name alone and the other way round.

Source§

impl SymbolTable

Source

pub fn take_unit_slots(&mut self) -> Vec<UnitSlot>

Takes the manifest of the unit that just compiled; a host that never takes it leaves it to expire when the next unit starts.

Source

pub fn settle(&mut self, name: &str, slot: Slot, ran: Option<usize>)

Settles slot of name once the unit ended: definition form ran of the slot, the last whose flag was 1, is kept, or for None the slot is put back as it stood before the unit. The other slots stay as the unit made them.

Source§

impl SymbolTable

Source

pub fn next_serial(&self) -> u32

The serial the next unit’s first new instance takes.

Source

pub fn instances(&self) -> impl Iterator<Item = (u32, &StructInstance)>

The live instances, by serial.

Source

pub fn settle_instances(&mut self, found: Found, next_serial: u32)

Replaces the heap with what a host read after a unit. An instance that is opaque, or reaches one or one never read, is dropped and so is every global that reaches it, loud when a later unit reads it; an instance no global or carried closure reaches is swept. The serial counter never goes back.

Source§

impl SymbolTable

Source

pub fn local_alias_origin(alias: &str) -> Option<&str>

The LABELS function an alias was made for.

Source§

impl SymbolTable

Source

pub fn register_test(&mut self, name: impl Into<String>, body: Expr)

Register a named test (DEFTEST); RUN-TESTS reads it via Self::tests. Re-registering an existing name overwrites its body in place (matching Self::define’s overwrite semantics) rather than appending, so the two-surface compile — which may evaluate a DEFTEST on both the eval and codegen passes — stays idempotent and never double-runs a test.

Source

pub fn tests(&self) -> Vec<(String, Expr)>

Snapshot of registered tests in declaration order. Cloned so RUN-TESTS can iterate without holding a borrow on the table it needs to evaluate against.

Source

pub fn mark_native_referenced(&mut self, name: &str)

Records a compile-time reference to native fn name. Called from the compiler’s host_fn::compile_host_fn_for_* whenever a wasm import call is emitted for name.

Source

pub fn native_coverage(&self) -> &HashMap<String, u32>

Compile-time reference counts per native fn name. The map only contains names that were emitted at least once; callers that need a complete-vs-missing report should cross-reference against the registered HostFnSpec list.

Source

pub fn register_host_fns(&mut self, host_fns: &[HostFnSpec])

Pre-registers the lisp-side symbol for each host fn so the compiler’s resolve_arg + native-dispatch path picks them up. The symbol’s value slot carries a WasmRuntime(result-type) stand-in so callers that eval the host-fn form during compile-time analysis (CONS element inference, arithmetic dispatch type lookup, etc.) see the right result type without needing to actually run the host fn. The matching wasm import is registered separately by CompileContext::new_eval_with_host_fns.

Source§

impl SymbolTable

Source

pub fn define_special(&mut self, symbol: Symbol)

Defines a global variable: one a callee sees even when a LET rebinds it.

Source§

impl SymbolTable

Source

pub fn load_nomiscript_defuns(&mut self, source: &str) -> Result<()>

Parses a DEFUN-only nomiscript source and registers each defun into this table via the eval special-form path. Shared by the universal prelude here and the rpc host prelude.

§Errors

The source does not parse, a top-level form is not a DEFUN, or a DEFUN is refused.

Source§

impl SymbolTable

Source

pub fn new() -> Self

Source

pub fn record_closure_result(&mut self, sig: ClosureSigId, result: WasmType)

Records the result WasmType for a closure signature id (see Self::closure_results). Called by the closure-emit sites, which hold the CompileContext and so know the sig’s true result type.

Source

pub fn closure_result(&self, sig: ClosureSigId) -> Option<WasmType>

The recorded result WasmType for a closure signature id, or None if the closure wasn’t emitted through a recording site (e.g. a closure reaching the eval surface from a path that doesn’t record).

Source

pub fn with_builtins() -> Self

Source

pub fn with_builtins_for_wasm() -> Self

Source

pub fn hidden_name(&self, factory: &str, param: &str) -> String

A variable name no program can spell or collide with, unique across every clone of this table, for the parameter param of factory.

Source

pub fn hidden_origin(name: &str) -> Option<(&str, &str)>

The (factory, parameter) a Self::hidden_name was made for.

Source

pub fn is_hidden_name(name: &str) -> bool

Source

pub fn lookup(&self, name: &str) -> Option<&Symbol>

Source

pub fn lookup_qualified( &self, namespace: Option<&str>, name: &str, ) -> Option<&Symbol>

Looks up a (possibly namespaced) name via its canonical key (ADR-0029). Resolution is strict and lexical: a qualified (Some(ns), name) looks up only NS:NAME, an unqualified (None, name) looks up only NAME — there is no cross-namespace fallback and no ambient “current namespace”. Most call sites pass the already-canonical Expr::Symbol string straight to Self::lookup; this helper is for callers that hold the split parts.

Source

pub fn lookup_mut(&mut self, name: &str) -> Option<&mut Symbol>

Source

pub fn remove(&mut self, name: &str) -> Option<Symbol>

Source

pub fn contains(&self, name: &str) -> bool

Source

pub fn iter(&self) -> impl Iterator<Item = (&String, &Symbol)>

Source

pub fn define_struct( &mut self, name: impl Into<String>, fields: Vec<String>, ) -> Result<StructId>

Trait Implementations§

Source§

impl Clone for SymbolTable

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SymbolTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SymbolTable

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more