Update Rust edition; Edit README; Clean up
This commit is contained in:
parent
68c77f5474
commit
5caad00f65
@ -5,7 +5,7 @@ resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
authors = ["Jeff Anderson"]
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0"
|
||||
readme = "README.md"
|
||||
repository = "https://git.jeffa.io/jeff/dust.git"
|
||||
|
13
README.md
13
README.md
@ -47,11 +47,10 @@ aspirations are to be **fast**, **safe** and **easy**.
|
||||
- **Fast**
|
||||
- **Fast Compilation** Despite its compile-time abstractions, Dust should compile and start
|
||||
executing quickly. The compilation time should feel negligible to the user.
|
||||
- **Fast Execution** Dust should be generally faster than Python, Ruby and NodeJS. It should be
|
||||
competitive with highly optimized, modern, register-based VM languages like Lua. Dust should
|
||||
be bench tested during development to inform decisions about performance.
|
||||
- **Low Resource Usage** Despite its performance, Dust's use of memory and CPU power should be
|
||||
conservative and predictable enough to accomodate a wide range of devices.
|
||||
- **Fast Execution** Dust should be competitive with highly optimized, modern, register-based VM
|
||||
languages like Lua. Dust should be bench tested during development to inform decisions about
|
||||
performance.
|
||||
- **Low Resource Usage** Memory and CPU power should be used conservatively and predictably.
|
||||
- **Safe**
|
||||
- **Static Types** Typing should prevent runtime errors and improve code quality, offering a
|
||||
superior development experience despite some additional constraints. Like any good statically
|
||||
@ -239,9 +238,7 @@ Dust has gone through several iterations, each with its own design choices. It w
|
||||
implemented with a syntax tree generated by an external parser, then a parser generator, and finally
|
||||
a custom parser. Eventually the language was rewritten to use bytecode instructions and a virtual
|
||||
machine. The current implementation: compiling to bytecode with custom lexing and parsing for a
|
||||
register-based VM, is by far the most performant and the general design is unlikely to change,
|
||||
although it has been optimized and refactored several times. For example, the VM was refactored to
|
||||
manage multiple threads.
|
||||
register-based VM, is by far the most performant and the general design is unlikely to change.
|
||||
|
||||
Dust previously had a more complex type system with type arguments (or "generics") and a simple
|
||||
model for asynchronous execution of statements. Both of these features were removed to simplify the
|
||||
|
@ -16,7 +16,7 @@ serde = { version = "1.0.203", features = ["derive"] }
|
||||
serde_json = "1.0.117"
|
||||
getrandom = { version = "0.2", features = [
|
||||
"js",
|
||||
] } # Indirect dependency, for wasm builds
|
||||
] } # Indirect dependency, for WASM builds
|
||||
smartstring = { version = "1.0.1", features = [
|
||||
"serde",
|
||||
], default-features = false }
|
||||
|
@ -25,7 +25,7 @@ mod type_checks;
|
||||
|
||||
pub use error::CompileError;
|
||||
use parse_rule::{ParseRule, Precedence};
|
||||
use tracing::{debug, info, span, Level};
|
||||
use tracing::{Level, debug, info, span};
|
||||
use type_checks::{check_math_type, check_math_types};
|
||||
|
||||
use std::mem::replace;
|
||||
@ -33,9 +33,9 @@ use std::mem::replace;
|
||||
use optimize::control_flow_register_consolidation;
|
||||
|
||||
use crate::{
|
||||
instruction::{CallNative, Close, GetLocal, Jump, LoadList, Negate, Not, Return, SetLocal},
|
||||
Argument, Chunk, ConcreteValue, DustError, DustString, FunctionType, Instruction, Lexer, Local,
|
||||
NativeFunction, Operation, Scope, Span, Token, TokenKind, Type, Value,
|
||||
instruction::{CallNative, Close, GetLocal, Jump, LoadList, Negate, Not, Return, SetLocal},
|
||||
};
|
||||
|
||||
/// Compiles the input and returns a chunk.
|
||||
@ -665,7 +665,7 @@ impl<'src> Compiler<'src> {
|
||||
expected: &[TokenKind::Bang, TokenKind::Minus],
|
||||
found: operator.to_owned(),
|
||||
position: operator_position,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -716,7 +716,7 @@ impl<'src> Compiler<'src> {
|
||||
return Err(CompileError::ExpectedExpression {
|
||||
found: self.previous_token.to_owned(),
|
||||
position: self.previous_position,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -826,7 +826,7 @@ impl<'src> Compiler<'src> {
|
||||
],
|
||||
found: operator.to_owned(),
|
||||
position: operator_position,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -836,8 +836,13 @@ impl<'src> Compiler<'src> {
|
||||
}
|
||||
|
||||
fn parse_comparison_binary(&mut self) -> Result<(), CompileError> {
|
||||
if let Some([Operation::EQUAL | Operation::LESS | Operation::LESS_EQUAL, _, _]) =
|
||||
self.get_last_operations()
|
||||
if let Some(
|
||||
[
|
||||
Operation::EQUAL | Operation::LESS | Operation::LESS_EQUAL,
|
||||
_,
|
||||
_,
|
||||
],
|
||||
) = self.get_last_operations()
|
||||
{
|
||||
return Err(CompileError::ComparisonChain {
|
||||
position: self.current_position,
|
||||
@ -898,7 +903,7 @@ impl<'src> Compiler<'src> {
|
||||
],
|
||||
found: operator.to_owned(),
|
||||
position: operator_position,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
let jump = Instruction::jump(1, true);
|
||||
@ -949,7 +954,7 @@ impl<'src> Compiler<'src> {
|
||||
expected: &[TokenKind::DoubleAmpersand, TokenKind::DoublePipe],
|
||||
found: operator.to_owned(),
|
||||
position: operator_position,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
let test = Instruction::test(operand_register, test_boolean);
|
||||
@ -1227,7 +1232,7 @@ impl<'src> Compiler<'src> {
|
||||
if let Some(Operation::LOAD_BOOLEAN | Operation::LOAD_CONSTANT) =
|
||||
self.get_last_operation()
|
||||
{
|
||||
let (mut loader, _, _) = self.instructions.last_mut().unwrap();
|
||||
let (loader, _, _) = self.instructions.last_mut().unwrap();
|
||||
|
||||
loader.set_c_field(true as u8);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user