chore: update changelog

This commit is contained in:
Araozu 2024-08-13 15:19:18 -05:00
parent 2b23e36955
commit 4ac01099ce
8 changed files with 25 additions and 33 deletions

View File

@ -5,30 +5,30 @@
- Test correct operator precedence - Test correct operator precedence
- Implement functions as first class citizens - Implement functions as first class citizens
- Parse __more__ binary operators - Parse __more__ binary operators
- Store tokens for the semantic analysis phase, to have actual error reporting
- Parse more complex bindings - Parse more complex bindings
- Rework error messages - Rework error messages
- Parse other language constructions - Parse other language constructions
- Type checking
- Check for conflicting identifiers
- Namespace identifiers in the symbol table - Namespace identifiers in the symbol table
- Stdlib - Stdlib
- Document code - Document code
- Watch mode - Watch mode
- Formatter
- Simple language server - Simple language server
- Decide how to handle comments in the syntax (?)(should comments mean something like in rust?) - Decide how to handle comments in the syntax (?)(should comments mean something like in rust?)
- Not ignore comments & whitespace, for code formatting - Fix comment handling in the AST
- Abstract the parsing of datatypes, such that in the future generics can be implemented in a single place - Abstract the parsing of datatypes, such that in the future generics can be implemented in a single place
- Include the original tokens in the AST
- Include comments in the AST
- Begin work on the code formatter - Begin work on the code formatter
- Remove all panic! and todo!
## v0.1.1 ## v0.1.1
- [x] Top level expressions as statements - [x] Top level expressions as statements
- [ ] Naively transpile variable bindings - [x] Naively transpile variable bindings
- [x] Store tokens in the AST, to have actual error reporting
- [x] Scan octal and binary numbers
- [x] Simple type checking
- [x] Check for conflicting identifiers at the current scope
## v0.1.0 ## v0.1.0

View File

@ -11,10 +11,8 @@ pub fn scan(chars: &Vec<char>, start_pos: usize) -> LexResult {
match (next_char_1, next_char_2) { match (next_char_1, next_char_2) {
// Test if the input contains a hex number // Test if the input contains a hex number
(Some('0'), Some('x'|'X')) => { (Some('0'), Some('x' | 'X')) => scan_hex(chars, start_pos + 2, String::from("0x")),
scan_hex(chars, start_pos + 2, String::from("0x")) (Some('0'), Some('o' | 'O')) => {
}
(Some('0'), Some('o'|'O')) => {
// octal // octal
scan_octal(chars, start_pos + 2) scan_octal(chars, start_pos + 2)
} }
@ -375,7 +373,7 @@ mod tests {
assert_eq!(t.get_end_position(), 4); assert_eq!(t.get_end_position(), 4);
assert_eq!(next, 4); assert_eq!(next, 4);
} }
_ => panic!("Expected a token") _ => panic!("Expected a token"),
} }
} }
@ -389,7 +387,7 @@ mod tests {
assert_eq!(error.end_position, 2); assert_eq!(error.end_position, 2);
assert_eq!(error.reason, "Found an incomplete octal number"); assert_eq!(error.reason, "Found an incomplete octal number");
} }
_ => panic!("Expected an error, got {:?}", result) _ => panic!("Expected an error, got {:?}", result),
} }
} }
@ -404,7 +402,7 @@ mod tests {
assert_eq!(t.get_end_position(), 6); assert_eq!(t.get_end_position(), 6);
assert_eq!(next, 6); assert_eq!(next, 6);
} }
_ => panic!("Expected a token") _ => panic!("Expected a token"),
} }
} }
@ -418,11 +416,10 @@ mod tests {
assert_eq!(error.end_position, 2); assert_eq!(error.end_position, 2);
assert_eq!(error.reason, "Found an incomplete binary number"); assert_eq!(error.reason, "Found an incomplete binary number");
} }
_ => panic!("Expected an error, got {:?}", result) _ => panic!("Expected an error, got {:?}", result),
} }
} }
// Should scan a double // Should scan a double
#[test] #[test]
fn test_double_1() { fn test_double_1() {

View File

@ -14,7 +14,6 @@ impl Positionable for FunctionCall<'_> {
} }
} }
#[derive(Debug)] #[derive(Debug)]
pub struct ArgumentsList<'a> { pub struct ArgumentsList<'a> {
pub arguments: Vec<Expression<'a>>, pub arguments: Vec<Expression<'a>>,

View File

@ -94,7 +94,11 @@ impl Positionable for Expression<'_> {
let (_, end) = exp.get_position(); let (_, end) = exp.get_position();
(start, end) (start, end)
} }
Expression::BinaryOperator(_, _, _) => (0, 1), Expression::BinaryOperator(left_expr, right_expr, _) => {
let (start, _) = left_expr.get_position();
let (_, end) = right_expr.get_position();
(start, end)
}
} }
} }
} }

View File

@ -36,8 +36,7 @@ fn parse_many<'a>(
tokens, next_pos, tokens, next_pos,
) { ) {
Ok((expr, next_pos)) => { Ok((expr, next_pos)) => {
let expr = let expr = Expression::BinaryOperator(Box::new(prev_expr), Box::new(expr), &token);
Expression::BinaryOperator(Box::new(prev_expr), Box::new(expr), &token);
parse_many(tokens, next_pos, expr, indentation_level + indent_count) parse_many(tokens, next_pos, expr, indentation_level + indent_count)
} }

View File

@ -36,8 +36,7 @@ fn parse_many<'a>(
tokens, next_pos, tokens, next_pos,
) { ) {
Ok((expr, next_pos)) => { Ok((expr, next_pos)) => {
let expr = let expr = Expression::BinaryOperator(Box::new(prev_expr), Box::new(expr), &token);
Expression::BinaryOperator(Box::new(prev_expr), Box::new(expr), &token);
parse_many(tokens, next_pos, expr, indentation_level + indent_count) parse_many(tokens, next_pos, expr, indentation_level + indent_count)
} }

View File

@ -36,11 +36,8 @@ fn parse_many<'a>(
// match next // match next
match super::unary::try_parse(tokens, next_pos) { match super::unary::try_parse(tokens, next_pos) {
Ok((expr, next_pos)) => { Ok((expr, next_pos)) => {
let expr = Expression::BinaryOperator( let expr =
Box::new(prev_expr), Expression::BinaryOperator(Box::new(prev_expr), Box::new(expr), &token);
Box::new(expr),
&token,
);
parse_many(tokens, next_pos, expr, indentation_level + indent_count) parse_many(tokens, next_pos, expr, indentation_level + indent_count)
} }

View File

@ -36,11 +36,8 @@ fn parse_many<'a>(
// Parse the next factor // Parse the next factor
match super::factor::try_parse(tokens, pos) { match super::factor::try_parse(tokens, pos) {
Ok((expr, next_pos)) => { Ok((expr, next_pos)) => {
let expr = Expression::BinaryOperator( let expr =
Box::new(prev_expr), Expression::BinaryOperator(Box::new(prev_expr), Box::new(expr), &token);
Box::new(expr),
&token,
);
parse_many(tokens, next_pos, expr, indentation_level + indent_count) parse_many(tokens, next_pos, expr, indentation_level + indent_count)
} }