Skip to content

Minimal and Unclear Error Messages #6

Description

@SAMBA8695

Description

The compiler currently provides minimal and unclear user-facing error messages. Many errors either fail silently or print generic messages without context, which makes debugging Cow programs difficult.

Examples include:

  • Missing or incorrect command-line arguments
  • Syntax errors during parsing
  • Undefined variables
  • Invalid token sequences

The compiler often exits without indicating where or why an error occurred.

Current Behavior

  • Generic messages like Include the file
  • Parser returns NULL without reporting an error
  • No line or column information is shown
  • Undefined variables do not produce errors
  • Compilation may stop silently

Example

$ ./cowc
Include the file

Expected Behavior

  • Clear and user-friendly error messages
  • Errors should explain what went wrong and where
  • Helpful messages for:
    • Invalid syntax
    • Missing semicolons
    • Undefined identifiers
    • Invalid command-line usage
  • Compiler should fail loudly and explicitly on errors

Example (desired)

error: undefined variable 'x' at line 2, column 9

Suggested Direction

  • Improve CLI usage messages (e.g. show expected usage)
  • Add structured error reporting in the parser
  • Propagate errors instead of returning NULL
  • Centralize error handling (e.g. error module)
  • Prepare for future line/column tracking in lexer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions