Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Wiki
  • Error messages
  • Error location presentation

Error location presentation · Changes

Page history
Introduced directories into the wiki and added content based on my talk with... authored Feb 07, 2025 by Quinten Cabo's avatar Quinten Cabo
Introduced directories into the wiki and added content based on my talk with Bodo and my own thoughts
Show whitespace changes
Inline Side-by-side
error-messages/Error-location-presentation.md 0 → 100644
View page @ de8600b9
How do we present the code where an error occurred?
We could pretty print the AST nodes that we think caused the error, or we could actually read the source file.
At the moment the compiler uses the gnu error format.
I think that reading the source file is better because it preserves the formatting of the programmer.
It is probably a good idea to investigate how other programming languages present the locations where errors occurred.
Here is a first proposal:
```
In /home/qc/School/Advanced-Programming/Week-3/homework.sac
102| foo = bar + 1;
^^^
```
But since your only really compiling one file at a time we could maybe leave out the file location if the error happens in the source code of the file your compiling:
```
102| foo = bar + 1;
^^^
```
Sometimes the compiler just doesn't know where errors happened due to intense optimalization.
This should either be fixed or the compiler should at least be honest to the programmer saying something like:
```txt
I do not know from where in your code this error originated, sorry.
Try to check the stack trace for clues, add more logging, or isolate the issue in a smaller test case.
If all else fails, take a break, sometimes bugs hide better when you're tired.
```
## About Columns
We should decide whether to include columns in the error message because I don't really believe human actually use that when it is printed in error messages. However, humans do click on them though.
Clone repository
  • concepts
    • Deprecated Modules
    • Globals
    • Named Tuples
    • Overloading
    • Preprocessor
    • Primitive functions
    • Runetime Representations
    • input stdin
    • phm xt
    • ref counting methods
    • type famlies
    • type patterns
  • error messages
    • Anthropomorphic error essages
    • Colored error messages
    • Empty file error
View All Pages