regexp(ing) Backus-Naurish expressions ...

J

Joshua Cranmer ðŸ§

Parsing is not lexing, usually parsing comes after lexing.

I agree, but Roedy wrote:
parsing Java, HTML, BAT language ... to do syntax colouring.

Syntax coloring generally requires nothing more than lexing the input to
figure which tokens are which.
 
A

Arne Vajhøj

I agree, but Roedy wrote:
parsing Java, HTML, BAT language ... to do syntax colouring.

Syntax coloring generally requires nothing more than lexing the input to
figure which tokens are which.

Some languages are tricky.

C# has contextual keywords.

dynamic dynamic;

is a valid declaration and the first is a keyword and the second
is a name.

Arne
 
E

Eric Sosman

I agree, but Roedy wrote:
parsing Java, HTML, BAT language ... to do syntax colouring.

Syntax coloring generally requires nothing more than lexing the input to
figure which tokens are which.

Is that how the NetBeans editor knows to display local
variables in black but class and instance fields in green?

;-)
 
R

Robert Klemme

Regexes are quite limited. When you bang into their limits you can
write a finite state machine or use a parser.

Roedy, I'm still curious what would make me want to write a FSM by hand
over using a Regex engine. What limitations and reasons did you have in
mind when you wrote the above?

Cheers

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top