And when we move from nouns to other parts of speech, we almost always find subtle but important differences among synonyms: although the meanings overlap, they differ in emphasis and connotation. But forest and wood, though often interchangeable, have different shades of meaning: a forest tends to be larger and denser than a wood. And if you ask for a soda on the east coast of the United States, you’ll get the same drink that asking for a pop will get you farther west. Just about every popular dictionary defines synonym as a term having “the same or nearly the same” meaning as another, but there is an important difference between “the same” and “nearly the same.” Noun synonyms sometimes mean exactly the same thing. The last thing is especially relevant since you've mentioned "meaning" in the (nomen omen) context of formal languages.English, with its long history of absorbing terminology from a wealth of other tongues, is a language particularly rich in synonyms -words so close in meaning that in many contexts they are interchangeable, like the nouns tongue and language in the first part of this sentence. if you would like to encode the semantics of Scala into a grammar, you would end up with either a context-free or a context-sensitive one.it is context-sensitive - it can be even more complex,.the entire Scala language is context-free,.So just this, as in the observation that the nonterminal "=>" can appear in two "places" of the program, does not make Scala context-sensitive. Obviously, this can generate a string like: Double=>Double=x=>x Where S is of course the start symbol, uppercased IDs are nonterminals, and quoted strings are terminals. This is essentially what the Pumping Lemma checks. Instead, it amounts to looking at the set of all legal expressions in that language, and seeing whether you can "encode" them only by taking into account the positional relationships the component "words" have with one another. It does not mean that a specific symbol cannot appear in different rules.Īddressing the edit: in other words (and more informally), deciding whether a language is context-free or context-sensitive boils down not to looking at the "meaning" of a specific "word" or "words". "Context-free" means that the production rules required in the corresponding grammar do not have a "context". It's been a while since I've handled formal language theory, but I'll bite. It be great if an answer would address my confusion. I think my confusion stems from reading something like "Chomsky introduced this term because a word's meaning can depend on its context", and I connected => with the term "word" in the quote, and those two uses of it being two separate contexts. I know how the production rules are supposed to look, and what they mean ( "this production applies only if A is surrounded by these symbols"), but I'm just not sure how they relate to actual (programming) languages. Seems like I don't understand context sensitive grammars well enough. I know that most languages are not context free, but I'm not sure whether the situation I'm describing has anything to do with that. How does this relate to formal grammars, i.e. According to this answer => in Scala is a keyword which has two different meanings: 1 to denote a function type: Double => Double and 2 to create a lambda expression: (x: Double): Double => 2*x.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |