Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@
- Claude initialized as contributor
- Created CLAUDE.md and primer.md
- Branch `claude` created off `main`

## [release] — 2026-03-17
- Shipped `rey v0.0.3-pre` on `codex`
- Added lexer support for skipping `//` comments
- Removed compiler warnings and cleaned unused parser/interpreter/lexer surfaces
- Hardened parser flow to prevent panic after lexer failure
- Updated/fixed test fixtures so every `.rey` file in `compiler/v1/src/tests/` runs cleanly
- Built and staged release binaries:
- `releases/0.0.3-pre/rey-v0-macos-arm64`
- `releases/0.0.3-pre/rey-v0-windows-x86_64.exe`
- Added `releases/0.0.3-pre/RELEASE.md`
4 changes: 0 additions & 4 deletions compiler/v1/src/ast/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ pub enum Expr {
name: String,
value: Box<Expr>,
},
Get {
object: Box<Expr>,
name: String,
},
}
16 changes: 1 addition & 15 deletions compiler/v1/src/interpreter/control_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,4 @@ impl ControlFlow {
pub fn return_value(value: Value) -> Self {
ControlFlow::Return(value)
}

pub fn unwrap_normal(self) -> Value {
match self {
ControlFlow::Normal(value) => value,
_ => panic!("Expected normal control flow"),
}
}

pub fn unwrap_return(self) -> Value {
match self {
ControlFlow::Return(value) => value,
_ => panic!("Expected return control flow"),
}
}
}
}
17 changes: 7 additions & 10 deletions compiler/v1/src/interpreter/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ impl Executor {
}
}
}
Expr::Get { .. } => {
Err("Property access not implemented yet".to_string())
}
}
}

Expand Down Expand Up @@ -233,20 +230,20 @@ impl Executor {
}
}
(Value::Number(l), EqualEqual, Value::Number(r)) => Ok(Value::Bool(l == r)),
(Value::Number(l), BangEqual, Value::Number(r)) => Ok(Value::Bool(l != r)),
(Value::Number(l), NotEqual, Value::Number(r)) => Ok(Value::Bool(l != r)),
(Value::Number(l), Less, Value::Number(r)) => Ok(Value::Bool(l < r)),
(Value::Number(l), LessEqual, Value::Number(r)) => Ok(Value::Bool(l <= r)),
(Value::Number(l), Greater, Value::Number(r)) => Ok(Value::Bool(l > r)),
(Value::Number(l), GreaterEqual, Value::Number(r)) => Ok(Value::Bool(l >= r)),

(Value::String(l), Plus, Value::String(r)) => Ok(Value::String(l + &r)),
(Value::String(l), EqualEqual, Value::String(r)) => Ok(Value::Bool(l == r)),
(Value::String(l), BangEqual, Value::String(r)) => Ok(Value::Bool(l != r)),
(Value::String(l), NotEqual, Value::String(r)) => Ok(Value::Bool(l != r)),

(Value::Bool(l), EqualEqual, Value::Bool(r)) => Ok(Value::Bool(l == r)),
(Value::Bool(l), BangEqual, Value::Bool(r)) => Ok(Value::Bool(l != r)),
(Value::Bool(l), And, Value::Bool(r)) => Ok(Value::Bool(l && r)),
(Value::Bool(l), Or, Value::Bool(r)) => Ok(Value::Bool(l || r)),
(Value::Bool(l), NotEqual, Value::Bool(r)) => Ok(Value::Bool(l != r)),
(Value::Bool(l), AndAnd, Value::Bool(r)) => Ok(Value::Bool(l && r)),
(Value::Bool(l), OrOr, Value::Bool(r)) => Ok(Value::Bool(l || r)),

_ => Err("Invalid binary operation".to_string()),
}
Expand All @@ -257,7 +254,7 @@ impl Executor {

match (op, right) {
(Minus, Value::Number(n)) => Ok(Value::Number(-n)),
(Bang, Value::Bool(b)) => Ok(Value::Bool(!b)),
(Not, Value::Bool(b)) => Ok(Value::Bool(!b)),
_ => Err("Invalid unary operation".to_string()),
}
}
Expand All @@ -281,4 +278,4 @@ impl Executor {
}
Ok(ControlFlow::normal(Value::Null))
}
}
}
8 changes: 0 additions & 8 deletions compiler/v1/src/interpreter/mod.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
pub mod control_flow;
pub mod environment;
pub mod evaluator;
pub mod executor;
pub mod function;
pub mod interpreter;
pub mod std;
pub mod value;

pub use control_flow::ControlFlow;
pub use environment::Environment;
pub use evaluator::Evaluator;
pub use executor::Executor;
pub use function::Function;
pub use interpreter::Interpreter;
pub use std::StdLib;
pub use value::Value;
4 changes: 0 additions & 4 deletions compiler/v1/src/lexer/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ impl<'a> Cursor<'a> {
pub fn position(&self) -> usize {
self.position
}

pub fn peek_ahead(&self, n: usize) -> Option<char> {
self.source[self.position..].chars().nth(n)
}
}
6 changes: 0 additions & 6 deletions compiler/v1/src/lexer/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

use super::span::Span;

#[derive(Debug, Clone)]
pub struct LexError {
pub message: String,
pub span: Span,
}

#[derive(Debug, Clone, PartialEq)]
pub enum LexerError {
UnexpectedCharacter { found: char, span: Span },
Expand Down
20 changes: 17 additions & 3 deletions compiler/v1/src/lexer/lexer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::lexer::token;

use super::{
cursor::Cursor,
error::LexerError,
Expand Down Expand Up @@ -54,7 +52,23 @@ impl<'a> Lexer<'a> {
'+' => Ok(self.simpleToken(TokenKind::Plus, start)),
'-' => Ok(self.simpleToken(TokenKind::Minus, start)),
'*' => Ok(self.simpleToken(TokenKind::Star, start)),
'/' => Ok(self.simpleToken(TokenKind::Slash, start)),
'/' => {
// check for comment
if let Some('/') = self.cursor.peek() {
// skip until end of line
self.cursor.advance();
while let Some(ch) = self.cursor.peek() {
if ch == '\n' {
self.cursor.advance();
break;
}
self.cursor.advance();
}
// recurse to get next token
return self.nextToken();
}
Ok(self.simpleToken(TokenKind::Slash, start))
}
':' => Ok(self.simpleToken(TokenKind::Colon, start)),
'.' => Ok(self.simpleToken(TokenKind::Dot, start)),
',' => Ok(self.simpleToken(TokenKind::Comma, start)),
Expand Down
14 changes: 0 additions & 14 deletions compiler/v1/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ pub enum TokenKind {
Not,
AndAnd,
OrOr,
BangEqual,
Bang,
Tilde,
PlusPlus,
MinusMinus,
PlusEqual,
MinusEqual,
StarEqual,
SlashEqual,
PercentEqual,
ColonEqual,

//keywords
Var,
Expand All @@ -58,7 +47,6 @@ pub enum TokenKind {
Identifier(String),
StringLiteral(String),
NumberLiteral(f64),
BooleanLiteral(bool),

//operators
Equal,
Expand All @@ -68,8 +56,6 @@ pub enum TokenKind {
NotEqual,
Less,
LessEqual,
And,
Or,

//special
Eof,
Expand Down
7 changes: 6 additions & 1 deletion compiler/v1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ fn main() {
}

let source = fs::read_to_string(&filename)
.expect(&format!("Failed to read {} file", filename));
.unwrap_or_else(|_| panic!("Failed to read {} file", filename));

let mut lexer = Lexer::new(&source);
let mut tokens = Vec::new();

let mut has_lexer_error = false;
loop {
match lexer.nextToken() {
Ok(token) => {
Expand All @@ -39,10 +40,14 @@ fn main() {
}
Err(err) => {
println!("Lexer error: {:?}", err);
has_lexer_error = true;
break;
}
}
}
if has_lexer_error {
return;
}
println!("Parsing Started.");
let mut parser = Parser::new(tokens);
match parser.parse() {
Expand Down
17 changes: 0 additions & 17 deletions compiler/v1/src/parser/error.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
use crate::lexer::span::Span;
use crate::lexer::TokenKind;

#[derive(Debug, Clone, PartialEq)]
pub enum ParserError {
UnexpectedToken {
expected: Vec<TokenKind>,
found: TokenKind,
span: Span,
},

UnexpectedEOF {
expected: Vec<TokenKind>,
span: Span,
},

Custom {
message: String,
span: Span,
},
}
impl ParserError {
pub fn new(message: String, span: Span) -> Self {
Self::Custom { message, span }
}
}
1 change: 0 additions & 1 deletion compiler/v1/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ pub mod error;
pub mod parser;

pub use parser::Parser;
pub use crate::ast::{Expr, Literal, Stmt, Type};
Loading
Loading