Hong-Phuc Bui on Thu, 30 Oct 2025 15:20:27 +0100


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

Re: [EXTERN] Re: Re: Re: Re: Re: Definition of tokens in GP language


Hi,

is it your intension, that the lexer in lang.l does not contain binary operators such as '*' or '+' in,
for example, '12 + 34.5'?

Best wishes
Hong-Phuc

On 29/10/2025 14:57, Bill Allombert wrote:
On Wed, Oct 29, 2025 at 02:27:16PM +0100, Hong-Phuc Bui wrote:
Hi,

I took a look into the file lang.l. I think here is discrepancy of the lexical rules and what the gp prompt does:
The rule

HEXINTEGER 0x[0-9A-Za-z]([0-9A-Za-z ]*[0-9A-Za-z])?

does accpets 0x1 2 3 zzz. But gp prompt does not:

? 0x1 2 3 zzz
   ***   syntax error, unexpected variable name, expecting end of file: 0x123zzz
   ***

Indeed, this is parsed as
0x123 zzz
which is a syntax error.

I would change the rule to be

HEXINTEGER 0x[0-9A-Fa-f]([0-9A-Fa-f ]*[0-9A-Fa-f])?

Thanks, I have update lang.l, same URL.

Cheers,
Bill.

--
Hochschule für Technik und Wirtschaft des Saarlandes
University of Applied Sciences

Fakultät für Ingenieurwissenschaften
School of Engineering

Hong-Phuc Bui, M.Sc.
Informatik

Campus Alt-Saarbrücken
Goebenstraße 40
66117 Saarbrücken

+49 (0) 681 58 67 - 804
hong-phuc.bui@htwsaar.de
www.htwsaar.de