Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving the debug system #57

Merged
merged 12 commits into from
May 27, 2024
Merged

Improving the debug system #57

merged 12 commits into from
May 27, 2024

Conversation

HuseyinSimsek7904
Copy link
Member

@HuseyinSimsek7904 HuseyinSimsek7904 commented May 24, 2024

Closes #27 , closes #35

In the old debug system, the error messages were directly dumped to the log stream and then the procedure would just exit the program with an error code. This meant that the error messages were somewhat simple and not very helpful.

In the new system, the error information is RETURNED from the called procedure to the caller procedure. This allows the caller procedure to improve the error messages by adding new layers of information about the error.

This is accomplished by creating a log-item structure. Any log item has a log type which contains information about what this log item represents, and log arguments which explain the log entry further. Procedures and macros for creating, managing and handling these log entries are defined inside compiler/debug.corth file.

These improvements also has a lovely side effect: The compiler now compiles itself much faster than it did before. The compiler used to take ~3 seconds to compile itself. It now takes ~1.15 seconds.

However, some of the error messages are not as useful as they could. These require future updates to make them more informative.

@HuseyinSimsek7904 HuseyinSimsek7904 added enhancement New feature or request debug Anything about debugging compiler Anything about the compiler labels May 24, 2024
@HuseyinSimsek7904 HuseyinSimsek7904 requested a review from Utkub24 May 24, 2024 21:12
@HuseyinSimsek7904 HuseyinSimsek7904 self-assigned this May 24, 2024
@HuseyinSimsek7904 HuseyinSimsek7904 force-pushed the improved-error-messages branch from 6bcf6ba to 4b77012 Compare May 24, 2024 21:13
@HuseyinSimsek7904 HuseyinSimsek7904 merged commit 0f1cbe7 into main May 27, 2024
1 check passed
@HuseyinSimsek7904 HuseyinSimsek7904 deleted the improved-error-messages branch May 27, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Anything about the compiler debug Anything about debugging enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler should not exit program Compiler should not stop compiling when it finds an error
1 participant