New answers tagged

0

The given grammar is context free, non-regular; but they ask for the grammar after eliminating left recursion (by whatever technique they teach to do so).


2

As a side note, that grammar is not written in BNF. Rather, it is written in one of many dialects of "extended" BNF, which includes repetition and optionality operators ({ … } and [ … ]). BNF only has simple productions. However, the repetition and optional components can be macro-expanded into BNF (using a newly-created non-terminal), and the "extended BNF" ...


1

The 'endless loop' is not a problem. Remember that there are many productions possible. A word is accepted by the grammar if there is any production that generates it. It doesn't matter if there are other productions (e.g., 'endless loops') that are pointless or never generate any word; they're harmless and irrelevant. No, this will not yield abababab.. ...


2

You haven't actually augmented the grammar. The augmented grammar has the production $$start\to SL\;\$$$ With that change, state 1 is not a reduction state and there is no conflict. If you did not intend to augment the grammar, then it is not $LR(0)$, because the language does not have the prefix property. But that's not very useful, so normally we augment ...


2

You'd need to define exactly what you mean by "parallelize". Besides, finding a parallelization (what a compiler is presumably asked to do) is a search problem, while NP is a set of decision problems. Search problems can't be "NP complete", they are a different kettle of fish. Sure, problems in NP often have corresponding search problems (see for example ...


0

One popular way to get a language quickly off the ground is to compile to a high-level language, like C. It gives you portability for free, and you can leverage the extensive optimization of the C compiler to get good object code. An interesting artifact from the early Unix times is RATFOR, a preprocessor for a somewhat-C-like language to FORTRAN (a ...


1

The use (or not) of a stack is strictly a matter of the language's implementation. E.g. FORTRAN is (was?) carefully defined so that no recursion is allowed, and no stack is needed. If your FORTRAN compiler uses a stack (and allows recursion) or not is anybody's guess. If your CPU sports a stack, chances are your FORTRAN uses it (as it is the machine's ...


2

The architecture of a computer is where concepts like "heap" and "call stack" originate from. If you take a look at the C standard (http://www.iso-9899.info/wiki/The_Standard) you won't find anything about the stack or heap. Compilers for a language like C can implement the specification in a number of ways in order to target specific architectures; even ...


Top 50 recent answers are included