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

  • Home
  • SEARCH
  • 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 719949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:42:09+00:00 2026-05-14T05:42:09+00:00

How does a lexer solve this ambiguity? /*/*/ How is it that it doesn’t

  • 0

How does a lexer solve this ambiguity?

/*/*/

How is it that it doesn’t just say, oh yeah, that’s the begining of a multi-line comment, followed by another multi-line comment.

Wouldn’t a greedy lexer just return the following tokens?

  • /*
  • /*
  • /

I’m in the midst of writing a shift-reduce parser for CSS and yet this simple comment thing is in my way. You can read this question if you wan’t some more background information.

UPDATE

Sorry for leaving this out in the first place. I’m planning to add extensions to the CSS language in this form /* @ func ( args, ... ) */ but I don’t want to confuse an editor which understands CSS but not this extension comment of mine. That’s why the lexer just can’t ignore comments.

  • 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-14T05:42:10+00:00Added an answer on May 14, 2026 at 5:42 am

    One way to do it is for the lexer to enter a different internal state on encountering the first /*. For example, flex calls these “start conditions” (matching C-style comments is one of the examples on that page).

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

Sidebar

Related Questions

this code is the base of lexer , and it does the basic operation
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone use have a good regex library that they like to use? Most
Does Ehcache 2.1 now support the transactional cache concurrency strategy in Hibernate 3.3.2GA? That
I have a lexer built that streams out tokens from in input but I'm
JsLex is a Javascript lexer I've written in Python. It does a good job
Given a lexer definition file, a grammar file (say, postgresql .y , .l flex
i want to parse something like this in my lexer: ( begin expression )
Does rails provide a way to ignore extra keys that are passed in to
Does Google force employees who have offers from Facebook to leave immediately?

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.