English 中文(简体)
Does anyone recognise this unfamiliar notation?
原标题:

I have a question from a test in a Programming Languages class that is confusing me.

Give a context-free grammar to generate the following language

L = { aibjck | 0 <= i <= j <= i + k }

I am completely unfamiliar with this notation. I cant seem to find anything in the book or my notes about it, and I have no idea how to query google for the answer.

If you recognize it, what is it called and what does it mean?

最佳回答

a^i just means a repeated i times. So a^2 = aa, b^10 = bbbbbbbbbb, etc.

问题回答

Often,

  • {} means "the set of"
  • | means "such that"

I have no idea what a, b, c are. i and j are non-negative numbers, being greater than or equal to zero. Conventionally, those letters are reserved for integers. The fact that

i <= i + k

means that k is also non-negative.

If a, b, and c are reals, then it seems to me that L is just the set of real numbers. However, it seems like a very contrived and elaborate way of specifying it. That would be something like Dr. Evil s plot to kill Austin Powers.

So you have "the set of a to the power i times b to the power j time c to the power j such that i, j and k are positive, and j is greater than or equal to i ..." and so on.





相关问题
Reserved keywords in Objective-C?

At the CocoaHeads Öresund meeting yesterday, peylow had constructed a great ObjC quiz. The competition was intense and three people were left with the same score when the final question was to be ...

ANTLR grammar license [closed]

I m planning to make an implementation of Lua for the DLR, and i would like to use the listed Lua 5.1 grammar here. However i can t see a license that it was released under, so can someone please ...

Does anyone recognise this unfamiliar notation?

I have a question from a test in a Programming Languages class that is confusing me. Give a context-free grammar to generate the following language L = { aibjck | 0 <= i <= j <= i + k } I ...

Question about building a symbol table with a yacc parser

If my yacc parser encounters the following code: int foo(int a, int b) should it add int a and int b as attributes of foo? The way I have it now, it enters a and b as separate table entries.

Tips on Using Bison --graph=[file] on Linux

Recently (about a month ago) I was trying to introduce new constructs to my company s in-house extension language, and struggling with a couple of reduce-reduce errors. While I eventually solved this ...

Yacc program not recognizing function declaration

I think my program should be able to recognize the following as a function declaration: int fn(int i) { int n; return; } but it doesn t. Here s the relevant part of my yacc file: program : ...

Grammars, Scala Parsing Combinators and Orderless Sets

I m writing an application that will take in various "command" strings. I ve been looking at the Scala combinator library to tokenize the commands. I find in a lot of cases I want to say: "These ...

What s the matter with this Grammar?

grammar Test; IDHEAD: ( a .. z | A .. Z | _ ); IDTAIL: (IDHEAD | 0 .. 9 ); ID: (IDHEAD IDTAIL*); fragment TYPE: ( text | number | bool ); define: define ID as TYPE; The problem ...

热门标签