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. |
||
|---|---|---|
| .. | ||
| snippets | ||
| src | ||
| syntaxes | ||
| themes | ||
| .vscodeignore | ||
| .vsix-version | ||
| bob-language-0.2.0.vsix | ||
| create-vsix.sh | ||
| example.bob | ||
| install.sh | ||
| INSTALLATION.md | ||
| language-configuration.json | ||
| package-vsix.sh | ||
| package.json | ||
| README.md | ||
| reload-extension.sh | ||
| test-operators.bob | ||
| tsconfig.json | ||
| version-info.md | ||
Bob Language Extension for VS Code
This extension provides syntax highlighting and language support for the Bob programming language in Visual Studio Code and Cursor.
Features
- Syntax Highlighting: Full syntax highlighting for Bob language constructs
- Code Snippets: Useful code snippets for common Bob patterns
- Auto-closing Brackets: Automatic bracket and quote pairing
- Indentation: Smart indentation for Bob code blocks
- Comments: Support for line and block comments
- Folding: Code folding support with region markers
Supported Syntax
Keywords
- Control flow:
if,else,while,for,break,continue,return - Variable declaration:
var - Function declaration:
func - Logical operators:
and,or,not
Built-in Functions
print(),assert(),input(),type(),toString(),toNumber(),time()sleep(),printRaw(),len(),push(),pop(),random(),eval()
Data Types
- Numbers (integers, floats, binary
0b1010, hex0xFF) - Strings (single and double quoted)
- Booleans (
true,false) - None value (
none) - Arrays (
[1, 2, 3])
Operators
- Arithmetic:
+,-,*,/,% - Comparison:
==,!=,<,>,<=,>= - Logical:
&&,||,! - Bitwise:
&,|,^,<<,>>,~ - Compound assignment:
+=,-=,*=,/=,%=,&=,|=,^=,<<=,>>= - Ternary:
condition ? valueIfTrue : valueIfFalse - String multiplication:
"hello" * 3
Installation
From Source
- Clone this repository
- Run
npm installto install dependencies - Run
npm run compileto build the extension - Press
F5in VS Code to launch the extension in a new window
Manual Installation
- Copy the extension files to your VS Code extensions directory
- Restart VS Code
- Open a
.bobfile to see syntax highlighting
Usage
Code Snippets
Type the following prefixes and press Tab to insert code snippets:
func- Function definitionif- If statementifelse- If-else statementwhile- While loopfor- For loopvar- Variable declarationprint- Print statementassert- Assert statementanon- Anonymous functionreturn- Return statementbreak- Break statementcontinue- Continue statementcomment- Comment blocktest- Test functionarray- Array declarationarrayaccess- Array accessarrayassign- Array assignmentlen- Array lengthpush- Array pushpop- Array poprandom- Random numbersleep- Sleep functionprintraw- Print raweval- Eval function
File Association
Files with the .bob extension will automatically be recognized as Bob language files.
Example
// This is a comment
var message = "Hello, Bob!";
print(message);
// Array operations
var numbers = [1, 2, 3, 4, 5];
print("Array length: " + len(numbers));
print("First element: " + numbers[0]);
// Function with ternary operator
func factorial(n) {
if (n <= 1) {
return 1;
}
return n * factorial(n - 1);
}
var result = factorial(5);
var status = result > 100 ? "large" : "small";
assert(result == 120, "Factorial calculation failed");
// String multiplication
var repeated = "hello" * 3; // "hellohellohello"
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This extension is licensed under the MIT License.