10 Commits

Author SHA1 Message Date
40ea6c1f8e Refactor expr parsing functions 2021-12-29 14:54:25 +01:00
12e95ed822 Remove BinOpType::Not from ast
- Impl. Display for BinOpType & UnOpType
- Impl. scuffed Display for Ast that just uses Debug pretty print
2021-12-29 02:22:03 +01:00
1712dac6d6 Impl. more expr types in parser
- Impl. unary bool not "!"
- Impl. relational exprs (">", ">=", "<", "<=")
- Impl. equality exprs ("==", "!=")
- Impl. bool and, or, xor ("&&", "||", "^^")
- Changed bool xor lexing from "^" to "^^" in order to keep "^"
  reserved for bitwise xor
- Prepared Ast for if, while & fn_def statements
2021-12-28 23:59:10 +01:00
cfc585426d Add comments & small additions
- Added more & better comments for `token.rs`, `lexer.rs`, `parser.rs`
- Implemented HashTag Token for Lexer
- Implemented additional safety checks for the Lexer::read functions
2021-12-28 20:43:24 +01:00
623fa71355 Add simple and very rough interpreter
- Implemented an interpreter that
  - Only works with int64 values
  - Executes maths expressions
  - Declares and assigns variables in global table
  - Can use variables in expressions
  - Debug prints expression only statements
  - Can NOT use, or declare functions
2021-12-24 02:25:27 +01:00
6bd58a4ecb Parse multiple statements
- parse() now parses a Vec<Statement> that can represent basically a
  full program
- Now multiple lines / statements are parsed together
2021-12-24 01:56:35 +01:00
41b7247ffd Implement some statements
- Impl. expression only statement (expr;)
- Impl. let binding ("let" ident "=" expr;)
- Impl. assignment (ident "=" expr;)
2021-12-24 01:48:18 +01:00
5be3fd5bbc Parse var and fn calls in expr
- Parse variable values in expressions
- Parse function calls in expressions
2021-12-24 01:25:04 +01:00
8de6e990b4 Start implementing parser
- Implemented AST + parsing for maths expressions
2021-12-23 22:59:57 +01:00
f2a00e6560 Initial commit
- Implemented basic lexer
- No spans implemented yet
- No real error handling yet
2021-12-23 16:48:49 +01:00