Skip to main content

Thread: Lex problem


hi,

have problem lex

if write 1 + 1 i'm getting:
found token int ('1')
found token op ('+')
found token int ('1')

if write 1+1 i'm getting:
found token int ('1')
found token int ('+1')

+1 part of language, need change if write 1+1 same if write 1 + 1?

regular expressions:
sign [+-]
digit [0-9]
digit_nz [1-9]
integer ([0])|(({sign}{0,1})({digit_nz}{1})({digit}*))

quote posted kirilik view post
hi,

have problem lex

if write 1 + 1 i'm getting:
found token int ('1')
found token op ('+')
found token int ('1')

if write 1+1 i'm getting:
found token int ('1')
found token int ('+1')

+1 part of language, need change if write 1+1 same if write 1 + 1?

regular expressions:
sign [+-]
digit [0-9]
digit_nz [1-9]
integer ([0])|(({sign}{0,1})({digit_nz}{1})({digit}*))

thanks
remove {sign} integer. have handle occurrences of it's unary operator in later step.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Lex problem


Ubuntu

Comments