Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
c4c23af
derive Eq and Hash for ArithmeticOperator
jonasstrehle Nov 11, 2025
6201e59
feat: add SubvariantNotFound variant to TypeError
jonasstrehle Nov 11, 2025
317d4c2
feat: implement variant access resolution and add tests (WIP)
jonasstrehle Nov 11, 2025
d3ad7df
add more test cases for variant access
jonasstrehle Nov 11, 2025
ac348cf
fmt
jonasstrehle Nov 11, 2025
58eb233
fmt
jonasstrehle Nov 11, 2025
e3b0446
[draft] Introduce TypeAlias
jonasstrehle Nov 13, 2025
b3dce6b
work on integer grammar (WIP)
jonasstrehle Nov 15, 2025
302652c
work on integer / decimal grammar (WIP)
jonasstrehle Nov 15, 2025
cc38467
work on integer / decimal grammar (WIP)
jonasstrehle Nov 15, 2025
64bb088
work on integer / decimal grammar (WIP)
jonasstrehle Nov 15, 2025
a192ac6
work on integer / decimal grammar (WIP) [fck logos]
jonasstrehle Nov 15, 2025
6f7cb2c
work on integer / decimal grammar (WIP) [fck logos]
jonasstrehle Nov 15, 2025
a5c15ae
add proper integer parsing to grammar (WIP)
jonasstrehle Nov 15, 2025
2bc28c1
add proper integer parsing to grammar (WIP)
jonasstrehle Nov 15, 2025
4d3f550
add proper decimal parsing to grammar (WIP)
jonasstrehle Nov 15, 2025
0703927
add proper decimal parsing to grammar (WIP)
jonasstrehle Nov 15, 2025
33a8a85
add proper decimal parsing to grammar (WIP)
jonasstrehle Nov 15, 2025
c9c4961
add grammar property assignment (WIP)
jonasstrehle Nov 15, 2025
9b96b25
add WIP marker
jonasstrehle Nov 15, 2025
8835065
grammar issues (WIP, broken)
jonasstrehle Nov 15, 2025
86f64a6
broken (WIP)
jonasstrehle Nov 16, 2025
7ad4440
fix mapping (WIP)
jonasstrehle Nov 16, 2025
4aeead4
rename dif update types
benStre Nov 16, 2025
6f042d7
refactor reference getters and setters
benStre Nov 16, 2025
4429350
refactor reference getters and setters
benStre Nov 16, 2025
786fd64
add splice dif operation, refactoring
benStre Nov 19, 2025
bf7c895
work on decimal (WIP)
jonasstrehle Nov 18, 2025
6112848
Fix #333
jonasstrehle Nov 18, 2025
c98dca3
Refactor decimal parsing logic to improve clarity and handle edge cases
jonasstrehle Nov 18, 2025
4d1e3c5
Refactor integer and decimal parsing to reuse parsing rules
jonasstrehle Nov 18, 2025
39f3239
snake_case
benStre Nov 20, 2025
5e31b67
fix empty map dif conversion
benStre Nov 20, 2025
1fa6776
add Marker type (wip)
benStre Nov 20, 2025
79a9377
fix decimal parsing
jonasstrehle Nov 21, 2025
57401fd
fix type infer
jonasstrehle Nov 21, 2025
cb4f904
reenable property access
jonasstrehle Nov 21, 2025
86e5f4d
fmt
jonasstrehle Nov 21, 2025
50827c7
add test case for property_access
jonasstrehle Nov 21, 2025
28bfb96
add visitor methods for property assignment
jonasstrehle Nov 21, 2025
e2bd65f
add FIXMEs
jonasstrehle Nov 21, 2025
a61d26c
add AssignmentToImmutableReference error
jonasstrehle Nov 21, 2025
12aeb58
add mutability getter
jonasstrehle Nov 21, 2025
83bbb84
add deref type inference and mut handling
jonasstrehle Nov 21, 2025
c32602d
add errors, move tests from compiler to type inference
jonasstrehle Nov 21, 2025
7e44cde
work on DIF type conversion (wip)
benStre Nov 23, 2025
94fba5d
work on DIF type conversion (wip)
benStre Nov 23, 2025
2e9326f
work on dif, type
benStre Nov 25, 2025
3140d8b
add has_default_type method
benStre Nov 26, 2025
88a33ca
update doc comments for TypeDefinition
benStre Nov 26, 2025
228aea2
:boom: refactoring (WIP)
benStre Nov 26, 2025
80b5825
refactoring on types (WIP)
jonasstrehle Nov 29, 2025
38eb3ad
refactoring on types (WIP)
jonasstrehle Nov 29, 2025
bca0909
refactoring on types (WIP)
jonasstrehle Nov 29, 2025
a58a596
refactoring on types (WIP)
jonasstrehle Nov 29, 2025
9295c02
refactoring on types (WIP)
jonasstrehle Nov 29, 2025
168bb21
refactoring on types (WIP)
jonasstrehle Nov 29, 2025
c281aa0
refactoring on types (WIP) [17 test failing]
jonasstrehle Nov 29, 2025
fdbfec9
fix type matching tests
benStre Dec 4, 2025
f1eee3e
remove debug log, all tests passed
benStre Dec 4, 2025
811928e
:wastebasket: refactoring, cleanup
benStre Dec 9, 2025
14fa6fa
:art: clippy
benStre Dec 9, 2025
f1baf3e
:art: fmt
benStre Dec 9, 2025
db424ae
:recycle: refactor DIFTypeDefinition serde
benStre Dec 9, 2025
b994bbe
:recycle: use serde_value instead of serde_jsona
benStre Dec 10, 2025
6069aaf
:bug: fix nostd errors
benStre Dec 10, 2025
19a8d35
:bug: refactor Deserialize for DIFTypeDefinition
benStre Dec 10, 2025
eb7f572
rename test-embedded
benStre Dec 10, 2025
19d8d72
:fire: remove DIFTypeContainer completely
benStre Dec 10, 2025
088a940
:recycle: refactor serde for DIFType to make it transparent for point…
benStre Dec 10, 2025
fbf2bf5
:recycle: refactor to_type_definition
benStre Dec 10, 2025
c2ede0f
:construction: work on type compiler
benStre Dec 10, 2025
c65ed81
:construction: work on type compiler
benStre Dec 10, 2025
6f889c1
:construction: work on type compiler
benStre Dec 10, 2025
f16e911
:bug: fix nostd
benStre Dec 12, 2025
e7e1b5b
:bug: fix RawPointerAddress sync
benStre Dec 12, 2025
fd5a653
:construction: work on type execution loop
benStre Dec 12, 2025
d38c1e6
:construction: work on type execution loop
benStre Dec 12, 2025
3b3bb93
:construction: work on type execution loop
benStre Dec 12, 2025
eb8ed13
:construction: refactoring of execution module structure
benStre Dec 13, 2025
ba46e06
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
41e764a
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
6555c95
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
e17f21c
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
9c6c9cf
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
3ae1620
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
d8840d6
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
4c76474
:recycle: parse loop refactoring (wip)
benStre Dec 13, 2025
f06ed7f
fix weird binrw bug that leads to compiler getting stuck
benStre Dec 13, 2025
bb28c7a
:construction: work on execution, refactoring, compiles without errors
benStre Dec 13, 2025
de2031f
:construction: work on execution refactoring, 80 tests failed
benStre Dec 14, 2025
5b90685
:construction: work on execution refactoring, 80 tests failed
benStre Dec 14, 2025
a854400
:construction: work on execution refactoring, 8 tests failed
benStre Dec 14, 2025
24a8679
:recycle: refactoring execution mode
benStre Dec 15, 2025
afa3f82
:recycle: refactoring execution mode
benStre Dec 15, 2025
6dedef2
:recycle: refactoring execution mode
benStre Dec 15, 2025
ffc7293
:recycle: refactoring execution mode
benStre Dec 16, 2025
4030c07
:bug: fix multiple external interrupts
benStre Dec 16, 2025
a59e12f
:wastebasket: cleanup
benStre Dec 16, 2025
5675539
:art: cargo fmt
benStre Dec 16, 2025
7388c3d
:construction: work on ast_from_bytecode
benStre Dec 16, 2025
81bc45d
:construction: work on ast_from_bytecode
benStre Dec 16, 2025
2231a85
Refactor imports to use local crate paths instead of datex_core
jonasstrehle Dec 16, 2025
3304c78
small refactoring
jonasstrehle Dec 16, 2025
52da530
fmt
jonasstrehle Dec 16, 2025
4fbe83c
fmt
jonasstrehle Dec 16, 2025
2b7788c
add map / short map
jonasstrehle Dec 16, 2025
7283a70
Add PointerAddress handling and refactor type instruction processing
jonasstrehle Dec 16, 2025
06ff2bd
:recycle: cleanup (big) integers + decimals
benStre Dec 19, 2025
764e3ab
:recycle: fixes
benStre Dec 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
files: target/nextest/ci/report.xml
test-embedded:
runs-on: macos-latest
name: Test
name: Test no-std/embedded build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-test-embedded
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ syntect = { version = "5.2.0", default-features = false, optional = true, featur
"default-fancy",
] }
pretty = { version = "0.12.5", optional = true }
chumsky = { version = "0.10.1", optional = true, features = [
chumsky = { version = "0.11.2", optional = true, features = [
"std",
], default-features = false }
logos = { version = "0.15.0", optional = true }
Expand Down
9 changes: 9 additions & 0 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Troubleshooting

This document provides solutions to common issues you may encounter while working with this project.

## Rust Compiler gets stuck during compilation without errors

Possible Fixes:
* Check if you made any modifications to structs that derive BinRead/BinWrite from `binrw` (e.g. in `src/global/protocol_structures/instructions.rs`).
Some values are not supported by `binrw` per default, e.g. `bool` values without custom mapping. In this case, the compiler may get stuck without providing any error messages.
18 changes: 6 additions & 12 deletions benches/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ pub fn json_to_json_syntax_value(json: &str) -> json_syntax::Value {
pub fn json_to_datex_value(json: &str) -> ValueContainer {
let (dxb, _) = compile_script(json, CompileOptions::default())
.expect("Failed to parse JSON string");
let exec_input = ExecutionInput::new_with_dxb_and_options(
&dxb,
ExecutionOptions::default(),
);
let exec_input =
ExecutionInput::new(&dxb, ExecutionOptions::default(), None);
execute_dxb_sync(exec_input).unwrap().unwrap()
}

Expand Down Expand Up @@ -72,10 +70,8 @@ pub fn json_to_runtime_value_datex<'a>(
},
)
.expect("Failed to parse JSON string");
let exec_input = ExecutionInput::new_with_dxb_and_options(
&dxb,
ExecutionOptions::default(),
);
let exec_input =
ExecutionInput::new(&dxb, ExecutionOptions::default(), None);
let val = execute_dxb_sync(exec_input).unwrap().unwrap();
assert!(val.to_value().borrow().is_map());
}
Expand Down Expand Up @@ -123,10 +119,8 @@ pub fn json_to_dxb<'a>(

// DXB -> value
pub fn dxb_to_runtime_value(dxb: &[u8]) {
let exec_input = ExecutionInput::new_with_dxb_and_options(
dxb,
ExecutionOptions::default(),
);
let exec_input =
ExecutionInput::new(dxb, ExecutionOptions::default(), None);
let json_value = execute_dxb_sync(exec_input).unwrap().unwrap();
assert!(json_value.to_value().borrow().is_map());
}
Expand Down
2 changes: 1 addition & 1 deletion src/ast/grammar/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub fn atom<'a>(
choice((
list,
map,
literal(),
decimal(),
literal(),
integer(),
text(),
endpoint(),
Expand Down
34 changes: 32 additions & 2 deletions src/ast/grammar/binding.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
use crate::ast::error::error::ParseError;
use crate::ast::error::pattern::Pattern;
use crate::ast::grammar::assignment_operation::assignment_operation;
use crate::ast::grammar::chain::property_access;
use crate::ast::grammar::r#type::{ty, type_declaration};
use crate::ast::grammar::utils::whitespace;
use crate::ast::lexer::Token;
use crate::ast::spanned::Spanned;
use crate::ast::structs::expression::VariableDeclaration;
use crate::ast::structs::expression::{
DerefAssignment, VariableAssignment, VariableKind,
};
use crate::ast::structs::expression::{
PropertyAssignment, VariableDeclaration,
};
use crate::ast::structs::r#type::TypeExpression;
use crate::ast::{
DatexExpression, DatexExpressionData, DatexParserTrait, ParserRecoverExt,
Expand Down Expand Up @@ -52,6 +55,28 @@ pub fn variable_assignment<'a>(
.labelled(Pattern::Declaration)
.as_context()
}

/// A variable assignment (e.g. `x.y.0 = 42` or `y.x += 1`)
pub fn property_assignment<'a>(
property_access: impl DatexParserTrait<'a>,
expression: impl DatexParserTrait<'a>,
) -> impl DatexParserTrait<'a> {
let assignment_op = assignment_operation();
property_access
.then(assignment_op)
.then(expression)
.map_with(|((access_expression, operator), expr), e| {
DatexExpressionData::PropertyAssignment(PropertyAssignment {
operator,
access_expression: Box::new(access_expression),
assigned_expression: Box::new(expr),
})
.with_span(e.span())
})
.labelled(Pattern::Declaration)
.as_context()
}

pub fn deref_assignment<'a>(
expression: impl DatexParserTrait<'a>,
unary: impl DatexParserTrait<'a>,
Expand Down Expand Up @@ -129,13 +154,18 @@ pub fn variable_declaration<'a>(

/// A declaration or assignment, e.g. `var x = 42;`, `const x = 69`, `x = 43;`, or `type x = 42`
pub fn declaration_or_assignment<'a>(
key: impl DatexParserTrait<'a>,
expression: impl DatexParserTrait<'a>,
unary: impl DatexParserTrait<'a>,
) -> impl DatexParserTrait<'a> {
choice((
property_assignment(
property_access(unary.clone(), key, expression.clone()),
expression.clone(),
),
type_declaration(),
variable_declaration(expression.clone()),
deref_assignment(expression.clone(), unary),
variable_assignment(expression),
variable_assignment(expression.clone()),
))
}
49 changes: 49 additions & 0 deletions src/ast/grammar/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,55 @@ pub fn indexed_parameters<'a>(
})
}

/// A property access chain, e.g. `a.b[c].d[e,f].5.g`
pub fn property_access<'a>(
unary: impl DatexParserTrait<'a>,
key: impl DatexParserTrait<'a>,
expression: impl DatexParserTrait<'a>,
) -> impl DatexParserTrait<'a> {
let dot_key = just(Token::Dot)
.ignore_then(key.clone())
.map(ApplyOperation::PropertyAccess);
let index = indexed_parameters(expression.clone())
.map(ApplyOperation::PropertyAccess);

// .key [expr]*
let dot_access = dot_key
.clone()
.then(index.clone().repeated().collect::<Vec<_>>())
.map(|(first, rest)| {
let mut ops = Vec::with_capacity(1 + rest.len());
ops.push(first);
ops.extend(rest);
ops
});

// [expr]+ index many1
let index_access = index
.clone()
.then(index.clone().repeated().collect::<Vec<_>>())
.map(|(first, rest)| {
let mut ops = Vec::with_capacity(1 + rest.len());
ops.push(first);
ops.extend(rest);
ops
});

let segment = choice((dot_access, index_access));

unary
.clone()
.then(segment.repeated().at_least(1).collect::<Vec<_>>())
.map_with(|(base, segs), e| {
let operations = segs.into_iter().flatten().collect::<Vec<_>>();
DatexExpressionData::ApplyChain(ApplyChain {
base: Box::new(base),
operations,
})
.with_span(e.span())
})
}

pub fn chain<'a>(
unary: impl DatexParserTrait<'a>,
key: impl DatexParserTrait<'a>,
Expand Down
Loading
Loading