lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Gé Weijers, Thank you for your detailed explanation.
My understanding of this question is at a different level with your
generous help.

I agree with what all you said indeed.

I still have a question, how C/C++ achieve this goal (i.e. reporting
multiple errors after running a compilation)?

Thanks to all of you.

Best regards
sunshilong

On Wed, Jan 27, 2021 at 2:39 AM Gé Weijers <ge@weijers.org> wrote:
>
> On Sun, Jan 24, 2021 at 11:20 PM 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
> >
> > Hi, list
> >       As the title, It seems impossible to achieve this goal since Lua
> > stops to do more work after encountering the first error.
> >       Am I missing something?
>
> The problem is that there is no good and efficient strategy to modify
> the input ('fix' the error) so the compiler is guaranteed to be able
> to continue and analyze the rest of the program in a meaningful way.
> What do you do, insert a symbol, delete a symbol, ...? If the 'fix' is
> wrong you're likely to end up with a cascade of error messages that
> are completely missing the mark.
>
> In the days when compiling a program took a long time there was a good
> reason to pay attention to recovering from compilation errors so you
> could fix multiple errors between compiler runs, but compiling a Lua
> program takes milliseconds on any reasonable machine so it's probably
> not worth the trouble to modify the parser to do something clever
> enough to recover from most errors.
>
> --
> Gé