Skip to content

Conversation

@dev-dami
Copy link
Owner

@dev-dami dev-dami commented Jan 20, 2026

Summary

  • Add GitHub Actions CI/CD workflow for automated testing, linting, and builds
  • Add golangci-lint configuration with sensible defaults for the codebase
  • Add parser error recovery to report multiple syntax errors instead of stopping at the first one

Changes

CI/CD Pipeline (.github/workflows/ci.yml)

  • Test job: Runs go test with race detection and coverage
  • Lint job: Runs golangci-lint
  • Build job: Builds the compiler and runs example files
  • Release job: Builds cross-platform binaries (linux/darwin/windows) on main branch pushes

Linting Infrastructure

  • Added .golangci.yml with errcheck, errorlint, gofmt, govet, staticcheck, etc.
  • Updated Makefile with lint, lint-fix, and check targets

Code Fixes

  • Fixed octal literals (06440o644) for modern Go style
  • Fixed error handling: use errors.As instead of type assertions for wrapped errors
  • Removed unused code (functions field in CGenerator, inferResultExprType function)
  • Fixed variable shadowing (maxmaxIdx, filepathexecPath)
  • Properly handle errors from filepath.Abs and FindProjectRoot

Parser Error Recovery

  • Added synchronize() function to skip to the next statement boundary on parse errors
  • Allows the parser to continue and report multiple errors instead of stopping at the first one

Verification

  • All tests pass: go test ./...
  • Linter passes clean: golangci-lint run ./...

Summary by CodeRabbit

Release Notes

  • New Features

    • Added built-in functions for environment variable access, file operations, command execution, and string/number parsing
    • Enabled passing program arguments to scripts
    • Enhanced string and character literals with escape sequence support
    • Added support for index-based assignment on arrays and maps
  • Chores

    • Added automated testing, linting, and release workflows
    • Added comprehensive test suite for language components

✏️ Tip: You can customize this high-level summary in your review settings.

- Add builtins for self-hosting: args(), exec(), exec_output(), mkdir(),
  append_file(), getenv(), setenv()
- Fix char comparison to compare values instead of pointers
- Fix escape sequence processing in char and string literals
- Add bootstrap lexer in Carv (examples/bootstrap/lexer.carv)
- Add test coverage for pkg/ast, pkg/codegen, pkg/module
- Add parse_int() and parse_float() builtins for string-to-number conversion
- Add index assignment support for arrays and maps (arr[i] = val, map[key] = val)
- Add bootstrap parser written in Carv (examples/bootstrap/parser.carv)
  - Uses Pratt parsing (recursive descent with operator precedence)
  - Parses all Carv constructs: functions, classes, let/const, if/else,
    for/for-in/while, match, pipe operator, etc.
  - AST nodes represented as maps for simplicity
- Add test file (examples/bootstrap/test_simple.carv)

This is an experimental branch for self-hosting exploration.
- Add GitHub Actions workflow for test, lint, build, and release
- Add golangci-lint configuration with sensible defaults
- Update Makefile with lint, lint-fix, and check targets
- Fix linting issues: octal literals, error handling, unused code
- Add parser synchronize() for error recovery to report multiple errors
- Use errors.As for proper wrapped error handling in builtins
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR establishes comprehensive Carv language infrastructure: adds GitHub Actions CI/CD automation with testing, linting, and release pipelines; implements a bootstrap parser and lexer; extends the runtime with CLI argument passing, process execution, and filesystem utilities; improves parser robustness via error recovery; and adds extensive test coverage across AST, code generation, module system, and parser components.

Changes

Cohort / File(s) Summary
CI/CD & Build Infrastructure
.github/workflows/ci.yml, .golangci.yml, Makefile
Adds GitHub Actions workflow with test, lint, build, and conditional release jobs; configures golangci-lint with 11 linters; replaces staticcheck with golangci-lint; adds lint-fix and check targets.
CLI Argument Handling
cmd/carv/main.go
Updates runFile to accept and forward program arguments via os.Args; improves path resolution with fallback behavior and warning logging; migrates file permissions to octal notation.
Bootstrap Language Implementation
examples/bootstrap/lexer.carv, examples/bootstrap/parser.carv, examples/bootstrap/test_simple.carv
Implements complete Carv lexer (~500 LOC) with tokenization, keywords, escape sequences; full Pratt-style parser (~1350 LOC) with expression/statement parsing, type annotations, error recovery; sample test program.
AST & Code Generation Tests
pkg/ast/ast_test.go, pkg/codegen/cgen_test.go
Adds unit tests for AST node types (primitives, expressions, control flow); verifies C code generation for language constructs (declarations, control flow, classes, type mappings).
Code Generation Refactoring
pkg/codegen/cgen.go
Removes unused functions []string field and inferResultExprType() method from CGenerator.
Runtime & Evaluation Enhancements
pkg/eval/builtins.go, pkg/eval/eval.go
Adds CLI args handling via SetArgs() and args() builtin; new parsing utilities (parse_int, parse_float); system interaction (exec, exec_output); filesystem utilities (mkdir, append_file, getenv, setenv). Updates evaluator with character infix operations and index-based assignment for arrays/maps.
Module System
pkg/module/loader.go, pkg/module/module_test.go
Improves loader initialization with explicit filepath error handling; comprehensive test suite validating loader lifecycle, config management, project discovery, module loading, and export extraction.
Parser Improvements
pkg/parser/parser.go, pkg/types/checker.go
Refactors parseStatement with error recovery via new synchronize() method; adds escape sequence support in strings/chars via unescapeString(); registers new builtin function signatures in type checker.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 A lexer and parser now hop through the code,
Bootstrap paths light the Carv language road,
With CI workflows, builtins galore—
The rabbit's built stages to open new doors! 🚀

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dev-dami dev-dami merged commit 1eb8a09 into main Jan 20, 2026
6 of 7 checks passed
@dev-dami dev-dami deleted the improvements/ci-linting-parser-recovery branch January 20, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants