tripon[github]

diagnostic codes / Lexer

E0002 invalid-character

A byte in the source is not part of Tripon's alphabet.

E0002invalid-characterASCII identifiers only; table in spec/tripon.md
severityerror
bandLexer
in the v0 bootstrapemitted
explainralt explain E0002

The lexer is ASCII. Identifiers are `[A-Za-z_][A-Za-z0-9_]*`, punctuation is the listed set, and string escapes are exactly `\n \t \r \0 \\ \"`. A non-ASCII letter outside a string, a single quote, a backtick, or an escape outside that list is reported here, one diagnostic per byte.

What it looks like

e0002.tp
use tier core;

fn main() -> i32 {
    let café = 1;
    print_i32(café);
    return 0;
}
ralt check e0002.tp
e0002.tp:4:12: error: unexpected character in source
  [E0002 invalid-character] ASCII identifiers only; table in spec/tripon.md
e0002.tp:4:13: error: unexpected character in source
  [E0002 invalid-character] ASCII identifiers only; table in spec/tripon.md
e0002.tp:5:18: error: unexpected character in source
  [E0002 invalid-character] ASCII identifiers only; table in spec/tripon.md
e0002.tp:5:19: error: unexpected character in source
  [E0002 invalid-character] ASCII identifiers only; table in spec/tripon.md

The `é` in `café` is two bytes in UTF-8, so it produces two diagnostics at the same identifier, and then two more on the use site. That is not noise: the lexer reports the exact bytes it could not classify.

What to do

  • Spell the name in ASCII: `cafe`.
  • Inside strings, use one of the six escapes; `\q`, `\x41` and `\u{...}` are not in the language.
  • For a literal `'`, use a double-quoted string containing `'`.

Why the code exists

One alphabet means one byte is one column, which means an agent can convert a span to an edit without a Unicode table in the loop.

What ralt explain says

ralt explain E0002
E0002
severity: error
name: invalid-character
hint: ASCII identifiers only; table in spec/tripon.md

Related