Skip to content

Feature: implemented Lua like errors#130

Open
reloginn wants to merge 4 commits intokyren:masterfrom
reloginn:lua-like-errors
Open

Feature: implemented Lua like errors#130
reloginn wants to merge 4 commits intokyren:masterfrom
reloginn:lua-like-errors

Conversation

@reloginn
Copy link

@reloginn reloginn commented Aug 18, 2025

Features

  • Added support for Lua-like stack trace generation via [error::ErrorWithStackTrace]
  • Updated error messages in stdlib, meta_ops.rs, parser.rs, lexer.rs, etc.
  • Updated [Parser] logic for improved error handling.
  • Updated some [Lexer] logic for improved error handling.
  • Added error builders in stdlib.
  • Updated goldenscripts and some tests.

Why is this needed?

Current errors in piccolo provide neither extensive information nor anything at all - the current parser provides no information about why an error occurred, where it occurred, and how it occurred, and the number of errors is very, very limited. Errors in stdlib are not standardized: some look like those in PUC-Rio Lua, others seem to be written "off the cuff"

A few examples

How it was before:

runtime error: parse error: parse error at line 1: expression is not a statement
runtime error: parse error: parse error at line 1: unexpected end of token stream
runtime error: parse error: parse error at line 2: expression is not a statement

How it is now:

<anonymous>:1: unexpected symbol near ')'
<anonymous>:1: ')' expected near <eof>
<anonymous>:1: 'end' expected near 'do'

all examples were taken from /examples/interpreter.rs

@reloginn reloginn changed the title Feature: implemented lua like errors Feature: implemented Lua like errors Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant