Changeset - 5da3dcf76c51
language_spec.md
Show inline comments
 
@@ -73,7 +73,6 @@ int-hex-constant = "0x" int-hex-char (int-hex-char | "_")* // 0xFEFE_1337
 
int-constant = int-bin-constant | int-oct-constant | int-dec-constant | int-hex-constant
 

	
 
// Floating point numbers
 
// TODO: Maybe support exponential notation? Seems silly for a networking
 
//  language, but might be useful? 
 
float-constant = DIGIT* "." DIGIT+
 

	
 
@@ -264,8 +263,6 @@ stmt = block |
 
    "new" cwb method-expr cw ";" |
 
    expr cw ";"
 
    
 
// TODO: Add all the other expressions
 
// TODO: Also: add struct construction and enum construction
 
method-params-list = "(" cw (expr (cw "," cw expr)* )? cw ")"
 
method-expr = method cw method-params-list
 

	
src/collections/freelist.rs
Show inline comments
 
@@ -20,7 +20,6 @@ pub struct Key<T> {
 

	
 
/// Generic freelist structure. Item insertion/retrieval/deletion works like a
 
/// HashMap through keys.
 
/// TODO: Use alloc::raw_vec::RawVec once stable and accessible
 
pub struct FreeList<T> {
 
    items: *mut Entry<T>,
 
    capacity: usize,
src/collections/mod.rs
Show inline comments
 
@@ -3,7 +3,6 @@ mod scoped_buffer;
 
mod sets;
 
mod raw_vec;
 

	
 
// TODO: Finish this later, use alloc::alloc and alloc::Layout
 
// mod freelist;
 

	
 
pub(crate) use string_pool::{StringPool, StringRef};
src/collections/string_pool.rs
Show inline comments
 
@@ -107,9 +107,8 @@ impl StringPool {
 
    /// reallocate/deallocate until dropped (which only happens at the end of
 
    /// the program.)
 
    pub(crate) fn intern(&mut self, data: &[u8]) -> StringRef<'static> {
 
        // TODO: Large string allocations, if ever needed.
 
        let data_len = data.len();
 
        assert!(data_len <= SLAB_SIZE, "string is too large for slab");
 
        assert!(data_len <= SLAB_SIZE, "string is too large for slab"); // if you hit this, create logic for large-string allocations
 
        debug_assert!(std::str::from_utf8(data).is_ok(), "string to intern is not valid UTF-8 encoded");
 
        
 
        let mut last = unsafe{&mut *self.last};
src/protocol/ast.rs
Show inline comments
 
// TODO: @cleanup, rigorous cleanup of dead code and silly object-oriented
 
//  trait impls where I deem them unfit.
 

	
 
use std::fmt;
 
use std::fmt::{Debug, Display, Formatter};
 
use std::ops::{Index, IndexMut};
 
@@ -404,7 +401,6 @@ impl ParserTypeVariant {
 
/// the compiler.
 
#[derive(Debug, Clone)]
 
pub struct ParserTypeElement {
 
    // TODO: @Fix span
 
    pub element_span: InputSpan, // span of this element, not including the child types
 
    pub variant: ParserTypeVariant,
 
}
 
@@ -1433,7 +1429,6 @@ impl Expression {
 
        }
 
    }
 

	
 
    // TODO: @cleanup
 
    pub fn parent(&self) -> &ExpressionParent {
 
        match self {
 
            Expression::Assignment(expr) => &expr.parent,
 
@@ -1450,7 +1445,7 @@ impl Expression {
 
            Expression::Variable(expr) => &expr.parent,
 
        }
 
    }
 
    // TODO: @cleanup
 

	
 
    pub fn parent_expr_id(&self) -> Option<ExpressionId> {
 
        if let ExpressionParent::Expression(id, _) = self.parent() {
 
            Some(*id)
src/protocol/ast_printer.rs
Show inline comments
 
@@ -887,7 +887,6 @@ fn write_parser_type(target: &mut String, heap: &Heap, t: &ParserType) {
 
    write_element(target, heap, t, 0);
 
}
 

	
 
// TODO: @Cleanup, this is littered at three places in the codebase
 
fn write_concrete_type(target: &mut String, heap: &Heap, def_id: DefinitionId, t: &ConcreteType) {
 
    use ConcreteTypePart as CTP;
 

	
src/protocol/eval/value.rs
Show inline comments
 
@@ -437,7 +437,6 @@ pub(crate) fn apply_binary_operator(store: &mut Store, lhs: &Value, op: BinaryOp
 
        let lhs_heap_pos = lhs_heap_pos as usize;
 
        let rhs_heap_pos = rhs_heap_pos as usize;
 

	
 
        // TODO: I hate this, but fine...
 
        let mut concatenated = Vec::new();
 
        let lhs_len = store.heap_regions[lhs_heap_pos].values.len();
 
        let rhs_len = store.heap_regions[rhs_heap_pos].values.len();
src/protocol/mod.rs
Show inline comments
 
@@ -61,10 +61,7 @@ impl std::fmt::Debug for ProtocolDescription {
 
    }
 
}
 
impl ProtocolDescription {
 
    // TODO: Allow for multi-file compilation
 
    pub fn parse(buffer: &[u8]) -> Result<Self, String> {
 
        // TODO: @fixme, keep code compilable, but needs support for multiple
 
        //  input files.
 
        let source = InputSource::new(String::new(), Vec::from(buffer));
 
        let mut parser = Parser::new();
 
        parser.feed(source).expect("failed to feed source");
 
@@ -158,7 +155,7 @@ impl ProtocolDescription {
 
        let module_root = self.lookup_module_root(module_name).unwrap();
 
        let root = &self.heap[module_root];
 
        let def = root.get_definition_ident(&self.heap, identifier).unwrap();
 
        // TODO: Check for polymorph
 

	
 
        ComponentState { prompt: Prompt::new(&self.types, &self.heap, def, 0, ValueGroup::new_stack(args)) }
 
    }
 

	
 
@@ -291,7 +288,6 @@ impl ProtocolDescription {
 
    }
 
}
 

	
 
// TODO: @temp Should just become a concrete thing that is passed in
 
pub trait RunContext {
 
    fn performed_put(&mut self, port: PortId) -> bool;
 
    fn performed_get(&mut self, port: PortId) -> Option<ValueGroup>; // None if still waiting on message
 
@@ -325,12 +321,10 @@ impl ComponentState {
 
            let step_result = self.prompt.step(&pd.types, &pd.heap, &pd.modules, ctx);
 
            match step_result {
 
                Err(reason) => {
 
                    // TODO: @temp
 
                    println!("Evaluation error:\n{}", reason);
 
                    todo!("proper error handling/bubbling up");
 
                },
 
                Ok(continuation) => match continuation {
 
                    // TODO: Probably want to remove this translation
 
                    EC::Stepping => continue,
 
                    EC::BranchInconsistent => return RR::BranchInconsistent,
 
                    EC::ComponentTerminated => return RR::ComponentTerminated,
 
@@ -376,7 +370,7 @@ impl ComponentState {
 
                    // Not possible to end sync block if never entered one
 
                    EvalContinuation::SyncBlockEnd => unreachable!(),
 
                    EvalContinuation::NewComponent(definition_id, monomorph_idx, args) => {
 
                        // Look up definition (TODO for now, assume it is a definition)
 
                        // Look up definition
 
                        let mut moved_ports = HashSet::new();
 
                        for arg in args.values.iter() {
 
                            match arg {
 
@@ -549,13 +543,6 @@ impl RunContext for EvalContext<'_> {
 

	
 
// TODO: @remove once old runtime has disappeared
 
impl EvalContext<'_> {
 
    // fn random(&mut self) -> LongValue {
 
    //     match self {
 
    //         // EvalContext::None => unreachable!(),
 
    //         EvalContext::Nonsync(_context) => todo!(),
 
    //         EvalContext::Sync(_) => unreachable!(),
 
    //     }
 
    // }
 
    fn new_component(&mut self, moved_ports: HashSet<PortId>, init_state: ComponentState) -> () {
 
        match self {
 
            EvalContext::None => unreachable!(),
src/protocol/parser/mod.rs
Show inline comments
 
@@ -172,7 +172,6 @@ impl Parser {
 
    }
 

	
 
    pub fn feed(&mut self, mut source: InputSource) -> Result<(), ParseError> {
 
        // TODO: @Optimize
 
        let mut token_buffer = TokenBuffer::new();
 
        self.pass_tokenizer.tokenize(&mut source, &mut token_buffer)?;
 

	
src/protocol/parser/pass_definitions.rs
Show inline comments
 
@@ -280,7 +280,6 @@ impl PassDefinitions {
 
        )?;
 
        let return_types = return_types.into_vec();
 

	
 
        // TODO: @ReturnValues
 
        match return_types.len() {
 
            0 => return Err(ParseError::new_error_str_at_pos(&module.source, open_curly_pos, "expected a return type")),
 
            1 => {},
src/protocol/parser/pass_tokenizer.rs
Show inline comments
 
@@ -157,36 +157,6 @@ impl PassTokenizer {
 
            self.add_code_range(target, 0, last_registered_idx, last_token_idx, NO_RELATION);
 
        }
 

	
 
        // TODO: @remove once I'm sure the algorithm works. For now it is better
 
        //  if the debugging is a little more expedient
 
        if cfg!(debug_assertions) {
 
            // For each range make sure its children make sense
 
            for parent_idx in 0..target.ranges.len() {
 
                let cur_range = &target.ranges[parent_idx];
 
                if cur_range.num_child_ranges == 0 {
 
                    assert_eq!(cur_range.first_child_idx, NO_RELATION);
 
                    assert_eq!(cur_range.last_child_idx, NO_RELATION);
 
                } else {
 
                    assert_ne!(cur_range.first_child_idx, NO_RELATION);
 
                    assert_ne!(cur_range.last_child_idx, NO_RELATION);
 

	
 
                    let mut child_counter = 0u32;
 
                    let mut last_valid_child_idx = cur_range.first_child_idx;
 
                    let mut child_idx = cur_range.first_child_idx;
 
                    while child_idx != NO_RELATION {
 
                        let child_range = &target.ranges[child_idx as usize];
 
                        assert_eq!(child_range.parent_idx, parent_idx as i32);
 
                        last_valid_child_idx = child_idx;
 
                        child_idx = child_range.next_sibling_idx;
 
                        child_counter += 1;
 
                    }
 

	
 
                    assert_eq!(cur_range.last_child_idx, last_valid_child_idx);
 
                    assert_eq!(cur_range.num_child_ranges, child_counter);
 
                }
 
            }
 
        }
 

	
 
        Ok(())
 
    }
 

	
src/protocol/parser/pass_typing.rs
Show inline comments
 
@@ -917,8 +917,6 @@ impl PassTyping {
 
        }
 
    }
 

	
 
    // TODO: @cleanup Unsure about this, maybe a pattern will arise after
 
    //  a while.
 
    pub(crate) fn queue_module_definitions(ctx: &mut Ctx, queue: &mut ResolveQueue) {
 
        debug_assert_eq!(ctx.module().phase, ModuleCompilationPhase::ValidatedAndLinked);
 
        let root_id = ctx.module().root_id;
src/protocol/parser/token_parsing.rs
Show inline comments
 
@@ -287,7 +287,6 @@ pub(crate) fn consume_comma_separated<T, F, E>(
 

	
 
/// Consumes an integer literal, may be binary, octal, hexadecimal or decimal,
 
/// and may have separating '_'-characters.
 
/// TODO: @Cleanup, @Performance
 
pub(crate) fn consume_integer_literal(source: &InputSource, iter: &mut TokenIter, buffer: &mut String) -> Result<(u64, InputSpan), ParseError> {
 
    if Some(TokenKind::Integer) != iter.next() {
 
        return Err(ParseError::new_error_str_at_pos(source, iter.last_valid_pos(), "expected an integer literal"));
src/protocol/parser/tokens.rs
Show inline comments
 
@@ -300,7 +300,6 @@ impl<'a> TokenIter<'a> {
 

	
 
    /// Returns the token range belonging to the token returned by `next`. This
 
    /// assumes that we're not at the end of the range we're iterating over.
 
    /// TODO: @cleanup Phase out?
 
    pub(crate) fn next_positions(&self) -> (InputPosition, InputPosition) {
 
        debug_assert!(self.cur < self.end);
 
        let token = &self.tokens[self.cur];
src/protocol/parser/type_table.rs
Show inline comments
 
@@ -875,7 +875,7 @@ impl TypeTable {
 
        let root_id = definition.defined_in;
 

	
 
        // Check and construct return types and argument types.
 
        debug_assert_eq!(definition.return_types.len(), 1, "not one return type"); // TODO: @ReturnValues
 
        debug_assert_eq!(definition.return_types.len(), 1, "not one return type");
 
        for return_type in &definition.return_types {
 
            Self::check_member_parser_type(
 
                modules, ctx, root_id, return_type, definition.builtin
src/protocol/parser/visitor.rs
Show inline comments
 
@@ -14,7 +14,6 @@ pub(crate) const STMT_BUFFER_INIT_CAPACITY: usize = 256;
 
pub(crate) const EXPR_BUFFER_INIT_CAPACITY: usize = 256;
 

	
 
/// General context structure that is used while traversing the AST.
 
/// TODO: Revise, visitor abstraction is starting to get in the way of programming
 
pub(crate) struct Ctx<'p> {
 
    pub heap: &'p mut Heap,
 
    pub modules: &'p mut [Module],
src/protocol/tests/parser_monomorphs.rs
Show inline comments
 
@@ -88,8 +88,6 @@ fn test_union_monomorphs() {
 
        .assert_has_monomorph("Trinary");
 
    });
 

	
 
    // TODO: Does this do what we want? Or do we expect the embedded monomorph
 
    //  Result<s8,s32> to be instantiated as well? I don't think so.
 
    Tester::new_single_source_expect_ok(
 
        "polymorphs",
 
        "
src/runtime2/branch.rs
Show inline comments
 
@@ -89,7 +89,7 @@ pub(crate) struct Branch {
 
    // Execution state
 
    pub code_state: Prompt,
 
    pub sync_state: SpeculativeState,
 
    pub awaiting_port: PortIdLocal, // only valid if in "awaiting message" queue. TODO: Maybe put in enum
 
    pub awaiting_port: PortIdLocal, // only valid if in "awaiting message" queue.
 
    pub next_in_queue: BranchId, // used by `ExecTree`/`BranchQueue`
 
    pub prepared: PreparedStatement,
 
}
src/runtime2/connector.rs
Show inline comments
 
@@ -77,7 +77,6 @@ pub(crate) struct ConnectorPDL {
 
    last_finished_handled: Option<BranchId>,
 
}
 

	
 
// TODO: Remove remaining fields once 'fires()' is removed from language.
 
struct ConnectorRunContext<'a> {
 
    branch_id: BranchId,
 
    consensus: &'a Consensus,
src/runtime2/consensus.rs
Show inline comments
 
@@ -121,7 +121,6 @@ impl Consensus {
 
        return !self.branch_annotations.is_empty();
 
    }
 

	
 
    /// TODO: Remove this once multi-fire is in place
 
    #[deprecated]
 
    pub fn get_annotation(&self, branch_id: BranchId, channel_id: PortIdLocal) -> &ChannelAnnotation {
 
        let branch = &self.branch_annotations[branch_id.index as usize];
src/runtime2/inbox.rs
Show inline comments
 
@@ -9,8 +9,6 @@ use super::ConnectorId;
 
use super::consensus::{GlobalSolution, LocalSolution};
 
use super::port::PortIdLocal;
 

	
 
// TODO: Remove Debug derive from all types
 

	
 
#[derive(Debug, Copy, Clone)]
 
pub(crate) struct ChannelAnnotation {
 
    pub channel_id: ChannelId,
src/runtime2/mod.rs
Show inline comments
 
@@ -509,7 +509,6 @@ impl RuntimeInner {
 
    }
 
}
 

	
 
// TODO: Come back to this at some point
 
unsafe impl Send for RuntimeInner {}
 
unsafe impl Sync for RuntimeInner {}
 

	
src/runtime2/native.rs
Show inline comments
 
@@ -463,7 +463,6 @@ impl ApplicationInterface {
 
    /// run the synchronous behaviour in blocking fashion. The results *must* be
 
    /// retrieved using `try_wait` or `wait` for the interface to be considered
 
    /// in non-sync mode.
 
    // TODO: Maybe change API in the future. For now it does the job
 
    pub fn perform_sync_round(&mut self, actions: Vec<ApplicationSyncAction>) -> Result<(), ApplicationStartSyncError> {
 
        if self.is_in_sync {
 
            return Err(ApplicationStartSyncError::AlreadyInSync);
src/runtime2/port.rs
Show inline comments
 
@@ -58,7 +58,6 @@ pub struct Port {
 
    pub peer_connector: ConnectorId, // might be temporarily inconsistent while peer port is sent around in non-sync phase
 
}
 

	
 
// TODO: Turn port ID into its own type
 
pub struct Channel {
 
    pub putter_id: PortIdLocal, // can put on it, so from the connector's point of view, this is an output
 
    pub getter_id: PortIdLocal, // vice versa: can get on it, so an input for the connector
src/runtime2/scheduler.rs
Show inline comments
 
@@ -277,10 +277,7 @@ impl Scheduler {
 
                    // may end up being rerouted.
 
                    let port_desc = scheduled.ctx.get_port_by_id(content.data_header.sending_port).unwrap();
 
                    debug_assert_eq!(port_desc.peer_id, content.data_header.target_port);
 

	
 
                    if port_desc.state == PortState::Closed {
 
                        todo!("handle sending over a closed port")
 
                    }
 
                    debug_assert_eq!(port_desc.state, PortState::Open); // checked when adding to context
 

	
 
                    (port_desc.peer_connector, true)
 
                },
 
@@ -294,9 +291,7 @@ impl Scheduler {
 
                Message::SyncPort(content) => {
 
                    let port_desc = scheduled.ctx.get_port_by_id(content.source_port).unwrap();
 
                    debug_assert_eq!(port_desc.peer_id, content.target_port);
 
                    if port_desc.state == PortState::Closed {
 
                        todo!("handle sending over a closed port")
 
                    }
 
                    debug_assert_eq!(port_desc.state, PortState::Open); // checked when adding to context
 

	
 
                    (port_desc.peer_connector, true)
 
                },
 
@@ -415,7 +410,6 @@ impl Scheduler {
 
        }
 
    }
 

	
 
    // TODO: Remove, this is debugging stuff
 
    fn debug(&self, message: &str) {
 
        println!("DEBUG [thrd:{:02} conn:  ]: {}", self.scheduler_id, message);
 
    }
0 comments (0 inline, 0 general)