Handle integer parsing exceptions in the lexer
まだ誰も着手していません。
評価
調査の方向性
compiler/main.cppで、issueで特定された整数の解析経路から調べ、lexerがトークンの位置を記録し、構文エラーを報告する方法を追ってください。不正な整数トークンと大きすぎる整数トークンがどのように処理されるかを確認し、それらに対してトークンの行と列を示す明確なエラーが出力され、std::stoiの例外が捕捉されずに発生しないことを検証してください。
索引モデルが issue の本文から書いたものです。
説明
Summary
The compiler tokenizes integers using std::stoi without validating the token or catching invalid conversion exceptions.
Problem
A numeric token like +, -, or an oversized integer can produce an exception instead of a clean syntax error. That creates hard-to-diagnose crashes during assembly.
Expected behavior
- Reject malformed integer literals with a clear error message.
- Report the line and column of the invalid token.
- Avoid uncaught exceptions from
std::stoi.
Relevant code
compiler/main.cppin the integer parsing path.
Suggested fix
Before calling std::stoi, validate the token string and catch std::invalid_argument/std::out_of_range to convert them into syntax errors with source positions.
- 主要言語
- C++
- スター
- 0
- フォーク
- 0
- 平均マージ
- 1分
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DavidSkillman/LittleManCompiler のほかの issue
-
bug copilot
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug copilot enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
DavidSkillman/LittleManCompiler の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
ROCm/rocm-systems#15475 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
Sendspin/sendspin-cpp#257 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
pocoproject/poco#5664 ·
メンテナーはふだん 2 日以内に返信
-
community:good-first-issue kind:bug kind:test scope:control status:needs-triage vehicle:rover
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
PX4/PX4-Autopilot#29727 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信