New answers tagged

6

Both work, so how you do it is up to you. But there are a couple of reasons to consider doing it during a post-parse analysis: While it is certainly possible to define two different types of block, one in which break is legal and the other one in which it isn't, the result is a lot of duplication in the grammar, and a certain complication because you have ...


1

The semantic rules of the attribute grammar "compute" the value of the expression to the left in terms of the values of the expressions to the right. With a grammar for regular expressions as you propose this is straightforward, but precisely because of that this can be confusing. For instance the meaning of the rule $S_0\to S_1 S_2$ is ...


0

Just use an array indexed by the characters, loop over the string increasing the respective count.


1

Any "interesting" regular expression (i.e., one that includes Kleene star) represents an infinite set. Thus to "calculate the set of all strings" won't work so well. In a sense, the regular expression is a compact description of the language. What other kind of description do you expect to construct? It is rather easy to construct regular ...


1

Admittedly, the parts dedicated to binding policies in the Programming Languages: Principles and Paradigms book could be more detailed. I'll try to convey some additional and contextual information, and answer directly to your questions along the way. Scope policies and binding policies As described around chapter 9, scope policies and binding policies are ...


0

The Unison programming language is based around two simple fundamental ideas: code is immutable code is content-addressed What does that mean? Code being immutable means just what it sounds like: since code is immutable, it will never change. You can only ever add new code to the system, but you can never change or remove existing code. Code being content-...


-1

This picture shows the hierarchy: Machine Language is the lowest. It is the most understandable by computer. High level language is the highest. It is the most understandable by human so far.


1

Perhaps a better way to try to understand which languages come from where is a directed graph on a timeline (like a family tree ). Shameless Plug


Top 50 recent answers are included