Commit Graph

46 Commits

Author SHA1 Message Date
7f7c6e438d Started fleshing out built in modules.
added policy templates for module safety
2025-08-12 03:26:50 -04:00
8cdccae214 Built in modules, user modules, ability to disable builtin modules 2025-08-12 00:16:36 -04:00
fc63c3e46f Try Catch bug fixing 2025-08-11 20:12:24 -04:00
227586c583 Try Catch 2025-08-11 18:26:41 -04:00
3138f6fb92 Various changes, again. Updated extension. Added classes, super, this, polymorphism.
Runtime: add method dispatch for array/string/dict/number (.len, .push, .pop, .keys, .values, .has, .toInt)
Stdlib: delete global len/push/pop/keys/values/has
Tests/docs/examples: migrate to method style; add tests/test_builtin_methods_style.bob
All tests pass
Breaking: global len/push/pop/keys/values/has removed; use methods instead
Parser/AST: add class/extends/extension/super, field initializers
Runtime: shared methods with this injection; classParents/classTemplates; super resolution; ownerClass/currentClass; extension lookup order
Builtins: method dispatch for array/string/dict/number (.len/.push/.pop/.keys/.values/.has/.toInt); remove global forms
Tests/docs/examples: add/refresh for classes, inheritance, super, polymorphism; migrate to method style; all tests pass
VS Code extension: update grammar/readme/snippets for new features
2025-08-10 22:44:46 -04:00
7a9c0b7ea9 Pre class implementation commit 2025-08-10 16:50:18 -04:00
266cca5b42 Code cleanup 2025-08-10 16:33:48 -04:00
85d3381575 Cleanup 2025-08-10 15:09:37 -04:00
f70c6abd77 Property Expression, Fixed memory leaks 2025-08-08 19:03:49 -04:00
87d56bbb13 Moved to cmake and ninja, updated docs 2025-08-07 19:09:25 -04:00
6c17ce96f0 Cleaned up project structure 2025-08-07 17:11:27 -04:00
2104fbe1f5 Clean up test files 2025-08-07 02:07:54 -04:00
32910b1e57 Add string indexing and comprehensive regression test 2025-08-07 02:06:52 -04:00
b97715e549 General fixes 2025-08-07 00:33:16 -04:00
eacb86ec77 feat: comprehensive language enhancements and code quality improvements
Major additions and improvements across the Bob language ecosystem:

Core Language Features:

- Add comprehensive dictionary support with full CRUD operations

- Implement built-in functions: keys(), values(), has() for dictionaries

- Add string multiplication operator (string * number)

- Enhance error reporting with detailed context and call stacks

- Add ternary operator support (condition ? true_expr : false_expr)

- Implement do-while loops with break/continue support

- Add array increment/decrement operators (++, --)

- Add cross-type comparison operators with proper type coercion

- Implement toInt() function for float-to-integer conversion

- Add float array index auto-truncation (like JavaScript/Lua)

Code Quality & Linter Fixes:

- Remove all "using namespace std;" statements (best practice)

- Add proper std:: prefixes throughout codebase

- Fix const correctness in helper functions

- Resolve class/struct declaration mismatches

- Fix sign comparison warnings in array indexing

- Remove unused lambda captures in built-in functions

- Fix brace initialization warnings in parser

Documentation & Tooling:

- Significantly expand BOB_LANGUAGE_REFERENCE.md with new features

- Update VS Code extension with enhanced syntax highlighting

- Add comprehensive code snippets for new language features

- Update version information and package metadata

Test Suite:

- Add extensive dictionary functionality tests

- Add tests for new operators and built-in functions

- Add comprehensive copy behavior tests (by value vs by reference)

- Add performance and edge case testing

Architecture Improvements:

- Enhance Value system with proper move semantics

- Improve memory management with shared_ptr for complex types

- Add trampoline-based tail call optimization

- Implement proper error context propagation

This represents a major milestone in Bob language development with production-ready dictionary support, comprehensive testing, and significantly improved code quality.
2025-08-07 00:12:04 -04:00
43c5f081d7 Error reporting fix 2025-08-06 21:46:52 -04:00
17c15e5bad Various changes
Arrays, loops, ternary, and other major features. Check doc
2025-08-06 21:42:09 -04:00
72a1b82b43 More things
- Add while, for, and do-while loops with break/continue
- Implement assignment statements (prevents if(x=10) bugs)
- Keep assignment expressions only for for-loop clauses
- Fix critical memory management bug (dangling pointers in cleanup)
- Add automatic memory cleanup with conservative reference counting
- Consolidate documentation into single reference file
- Add comprehensive test coverage for all loop types and edge cases
- VSCode extension for bob highlighting and snippets
2025-08-06 00:57:36 -04:00
671f8a6350 RAII env 2025-08-05 20:40:40 -04:00
b87b342dff Tail call testing 2025-08-05 19:06:52 -04:00
313c996edd Cross platform fixes 2025-08-05 01:42:38 -04:00
72a31b28af Refactor to ExecutionContext pattern and fix string + none concatenation
- Add none value handling to Value::operator+ for string concatenation
- Replace direct string concatenations with Value::operator+ calls in Interpreter
- Add missing string+none and none+string type combinations
- Standardize token literal generation in Lexer
- Add ExecutionContext support across visitor pattern
- Enhance error reporting integration
- Add new standard library functions
2025-08-05 00:49:59 -04:00
adb00d496f Fixed performance, added enhanced error reporting, anon funcs, toBoolean, various other things 2025-08-01 13:43:35 -04:00
1e65b344ae Major speed optimization
- Replace Object* with Value tagged union for better performance
- Fix bug where "true"/"false" strings were treated as booleans
- Add isBoolean field to LiteralExpr to distinguish string vs boolean literals
- Implement fast function calls with g_returnContext instead of exceptions
- Add functions vector to prevent dangling pointers
- Remove try-catch blocks from execute() for 50x performance improvement
- Clean up test files, keep only main test suite and fib benchmark
- All 38 tests passing, fib(30) still ~848ms
2025-07-31 00:16:54 -04:00
cb14221429 Added if statements, more stdlib functions 2025-07-30 19:31:29 -04:00
7c57a9a111 Implement functions, closures, standard library, and comprehensive number system
- Add function declarations, calls, and return statements
- Implement lexical scoping with Environment class and closures
- Convert print from statement to standard library function
- Add assert() function to standard library for testing
- Add time() function for microsecond precision benchmarking
- Create StdLib class and BuiltinFunction wrapper for standard library
- Implement first-class functions and higher-order functions
- Add function parameter support (tested up to 100 parameters)
- Support alphanumeric identifiers in variable and function names
- Add underscore support in variable names and identifiers
- Implement string + number and number + string concatenation
- Add boolean + string and string + boolean concatenation
- Support string multiplication (string * number)
- Fix decimal truncation issue by using std::stod for all number parsing
- Add comprehensive number formatting with proper precision handling
- Support huge numbers (epoch timestamps) without integer overflow
- Clean number display (no trailing zeros on integers)
- Add basic error handling with program termination on errors
- Add comprehensive test suite covering all features
- Add escape sequence support (\n, \t, \", \\)
- Add comprehensive documentation and language reference
- Update development roadmap with completed features
2025-07-30 17:51:48 -04:00
Bobby Lucero
8258df216e Added simple escape character support 2023-06-02 14:43:33 -04:00
Bobby Lucero
942c1e323b Tidy code, interactive interpreter prints out result of expression without explicit print statement 2023-06-01 17:19:19 -04:00
Bobby Lucero
fe26a7c2e0 Added scopes 2023-05-31 02:44:39 -04:00
Bobby Lucero
7e0cead697 Added variable assignments 2023-05-31 01:48:50 -04:00
Bobby Lucero
03bfae9eb4 techdebt tracking for future me to handle 2023-05-30 16:31:28 -04:00
31b334ec65 Bug fixes 2023-05-28 15:13:59 -04:00
b38f6bff25 Fixed header duplicate symbols 2023-05-27 21:18:53 -04:00
92cd4e542a Binary and hex notation 2023-05-27 20:12:30 -04:00
3e5ba29283 It's alive! (implemented base interpreter) 2023-05-27 16:04:39 -04:00
9500cf9773 Removed templating as it turns out, wasn't needed. Added shorthands to make the code less ugly 2023-05-27 13:11:08 -04:00
a0ec4af169 ASTPrinter now prints generated AST from parser 2023-05-27 02:05:06 -04:00
fc0d9137a5 Initial Parser 2023-05-27 01:20:38 -04:00
f8853d022b More makefile changes 2023-05-26 21:14:13 -04:00
00cbc056c8 Code cleaning, fixed makefile project errors for CLion 2023-05-26 21:05:03 -04:00
7b59f1f596 Minor Changes 2023-05-24 00:57:49 -04:00
d909e546f2 Rough implementation of ASTPrinter complete with nasty shared_ptr syntax :) 2023-05-24 00:29:12 -04:00
c5f981321c AST Struct Generator 2023-05-21 20:40:43 -04:00
dfc518c582 Added more lexer tokenization cases, string literal and number tokenization 2023-05-21 00:52:05 -04:00
23799125a7 Bob interpreter refactored into object 2023-05-20 20:51:46 -04:00
650771e6fe Initial Commit 2023-05-20 16:07:51 -04:00