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 122627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:09:31+00:00 2026-05-11T04:09:31+00:00

Since I’ve gotten no answer at all to my question Is there an alternative

  • 0

Since I’ve gotten no answer at all to my question Is there an alternative to MKS Yacc that supports selection preference syntax or something very similar?, I’ll ask the more basic question:

  • Has anyone used the "selection preferences" provided by MKS Yacc?

If you have, what did you use it for? Also, does it make any sense to use it in anything other than the last position in a rule?

I have to look after a grammar which figures rules such as:

    TOKEN1 LPAREN non_terminal1 [^EQUAL] TOKEN2 non_terminal2 RPAREN 

Unless I’m misunderstanding something, the embedded selection preference doesn’t provide any value whatsoever in this context.

Background

MKS Yacc supports a notation which their web site calls "selection preference syntax". It isn’t illustrated, but it consists of a token or list of tokens in square brackets with a caret (which might be optional), and it indicates that the particular token must not follow this construct, but that token is not counted as part of this rule:

non_terminal1:  TOKEN1 non_terminal2 TOKEN2 [^TOKEN3] 

So, this rules says that a TOKEN1 followed by a non_terminal2 and a TOKEN2 is a non_terminal1, unless the next token is a TOKEN3 in which case some other rule applies.

(I’m not clear whether the bracketed item can be a non-terminal. The code I’ve seen using the notation always uses a token or a couple of space separated tokens, and never a non-terminal. I’m also not clear whether the caret is required; again, all the examples I’ve seen use the caret.)

  • 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. 2026-05-11T04:09:32+00:00Added an answer on May 11, 2026 at 4:09 am

    Jonathan. at 1:30 AM I’m not prepared to try to do this myself, but whatever those rules do, they can only be shorthand for rules that could be written in something like normal BNF. Looking at this, it appears that what the ‘selection preference’ is doing is allowing you to express what would otherwise be several productions with one grammar rule.

    I did a little digging and found this, which confirms my supposition: what the selection preference does is lets you explicitly insert a lookahead, so that rules which would otherwise be in conflect can be disambiguated.

    What I’d suggest is to think about what one of these rules would look like if re-written into yacc or straight BNF. I suspect it will turn out something like

    TOKEN1 LPAREN non_terminal1 MULT TOKEN2 non_terminal2 RPAREN TOKEN1 LPAREN non_terminal1 DIVIDE TOKEN2 non_terminal2 RPAREN TOKEN1 LPAREN non_terminal1 ADD TOKEN2 non_terminal2 RPAREN TOKEN1 LPAREN non_terminal1 SUBTRACT TOKEN2 non_terminal2 RPAREN TOKEN1 LPAREN non_terminal1 EXP TOKEN2 non_terminal2 RPAREN TOKEN1 LPAREN non_terminal1 MOD TOKEN2 non_terminal2 RPAREN ... 

    So that the overall effect is to take one rule for every operator except equal, the [^ notation being common in the various Bell Labs languages for something like the complement of a set.

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

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 72k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You need libudf which is part of GNU libcdio. May 11, 2026 at 1:44 pm
  • added an answer Perhaps one or more of the files is read-only? Use… May 11, 2026 at 1:44 pm
  • added an answer Easiest way would be to let the math parser do… May 11, 2026 at 1:44 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.