Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6617819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:44:58+00:00 2026-05-25T20:44:58+00:00

What kind of problems other than writing compilers can be solved using Lexers and

  • 0

What kind of problems other than writing compilers can be solved using Lexers and Parsers ?

What are the advantages / disadvantages of using Lexers and Parsers over just writing regular expression statements in a programming language.

Are there any situations where only a Lexer or only a Parser is used ?

PS: Precise Comparison Examples would be nice

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:44:59+00:00Added an answer on May 25, 2026 at 8:44 pm

    Lexers and parsers are good for computerized interpretation of anything that is a context-free language but not a regular language.

    In more practical terms, this means that they’re good for interpreting anything that has a defined structure but is beyond the capabilities of (or more difficult to do with) regex.

    For instance, it is difficult if not impossible to write a regular expression which will determine if a given document is valid HTML (due to things like tag nesting, escape characters, required attributes, et cetera). On the other hand, it’s (relatively) trivial to write a parser for HTML.

    Similarly, you would probably not want to even try to write a regex to determine the order of operations in a mathematical expression. On the other hand, a parser can do it easily.


    As for your question regarding individual lexers or parsers:

    Neither is “necessary” for the other, or at all.

    For instance, one could have human-readable words which translate directly to machine opcodes that would get lexed directly into machine code (this would essentially be a very basic “assembly language”). This would not require a parser.

    One could also simply write programs in a way that already was expressed in machine-readable individual symbols and thus easy for a machine to parse – for instance, boolean algebra expressions that used only the symbols 0, 1, &, |, ~, (, and ). This would not require a lexer.

    Or you could do without either – for instance, Brainfuck needs neither lexing nor parsing because it is simply a set of ordered instructions; the interpreter just maps symbols to things to do. Machine opcodes, similarly, do not require either.

    Mostly, lexers and parsers are written to make things nicer and easier. It’s nicer not to have to write everything in individual single-meaning glyphs. It’s easier to be able to write out complex expressions in whatever way is convenient (say, with parentheses, (3+4)*2) than it is to force ourselves to write them in ways that machines work (say, RPN: 3 4 + 2 *).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure this is the kind of problem other have solved many times before.
Even though I've been reading other topics about my kind of problem, I can't
What kind of problems might this cause? Is it better to install in a
I am a newbie for solving these kind of problems. I need to extract
I'm writing an MVC2 app using DataAnnotations. I have a following Model: public class
I'm writing a web application that's supposed to be embedded in other people's websites
I'm writing a concolic engine for Python using the sys.settrace() functionality. The main task
I have some kind of problem with jQuery selectors. Let's say i want to
I got a kind of weird problem: I want to fade images. The Code
This is kind of a oddball problem so I will try to describe the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.