feat: implement infix arithmetic operators for numbers and string concatenation
Add parser support for +, -, *, / operators with correct precedence (term/factor) and emit method calls. Implement primitive methods for num_plus, num_minus, num_multiply, num_divide, and string_plus. Update VM to pass VM pointer to primitives and add unsupported value for type errors. Include test files for each operator.
This commit is contained in:
+6
-9
@@ -1,9 +1,6 @@
|
||||
class Foo { // line comment
|
||||
bar {
|
||||
123
|
||||
}
|
||||
}
|
||||
var a = Foo.new
|
||||
a.bar
|
||||
"something".contains("meth")
|
||||
io.write("hey there")
|
||||
io.write(1 + 2)
|
||||
io.write(3 - 1)
|
||||
io.write(10 / 3)
|
||||
io.write(20 * 30)
|
||||
io.write("abc" + "def")
|
||||
io.write(1 + "string")
|
||||
|
||||
Reference in New Issue
Block a user