Files
rlox/examples/example.lox
T
Giulio Agostini c1ecd7d1f7 Switch interpreter to use new base value types
The commit changes the interpreter and related code to use the new
`BaeValue` and `Number` types, moving away from direct floats. The main
changes include:

- Replace LiteralValue with BaeValue across the codebase - Add Number
enum for type-safe numeric values - Move AST definitions to common
module - Update operators to handle new numeric types - Add 'is' token
type and parser support Switch to common base_value library for value
types

This commit represents a significant refactoring to switch the
interpreter to use a new shared base value type system. The main changes
include:

1. Move value types to a new common/base_value.rs module 2. Add richer
numeric type support with promotion rules 3. Update interpreter to use
new BaseValue enum 4. Move AST types to common module for sharing 5.
Consolidate value operations like Add, Sub etc 6. Add proper test
coverage for numeric operations

The commit improves type safety and adds more robust numeric handling
while keeping the interpreter's core logic clean.
2025-10-07 14:28:24 +02:00

29 lines
604 B
Lox

// var Person :: struct {
// name: String,
// age: Int,
// address: String,
// }
//func_name :: fn(param: Number, param2: String) {param is Int} do
func_name :: fn(param: Int, param2: String) do
print param;
cavallo := 5;
print cavallo;
while cavallo < 10 do
cavallo = cavallo + 1;
print cavallo;
end
if True then do
print "this shoul be stop";
return False;
end
print "this shoud be un other stop";
return 42;
for i := 11; i <= 21; i = i + 1; do
print i;
end
return False or True;
end
func_name(1,2)