I am reading The Java Language Specification 8.
I am trying to understand Chapter 2. Grammars.
Here's what I have already learned:
Semantics:
Semantics is the study of meaning.
Meaning:
Meaning, in semantics, is defined as being Extension: The thing in the world that the word/phrase refers to, plus Intention: The concepts/mental images that the word/phrase evokes.
Syntax:
Syntax is all about the structure of sentences, and what determines which words go where.
Production:
A production or production rule in computer science is a rewrite rule specifying a symbol substitution that can be recursively performed to generate new symbol sequences.
Alphabet:
A non-empty set is called alphabet when its intended use in string operations shall be indicated.
Lexeme:
A lexeme is a string of characters which forms a syntactic unit.
Syntactic unit:
Sentence is the "highest" (i.e., largest) syntactic unit,
the lowest (i.e., smallest) syntactic units are words,
the intermediate syntactic units are the phrases.
Token:
A token is a structure representing a lexeme that explicitly indicates its categorization for the purpose of parsing.
Grammar:
A grammar (when the context is not given, often called a formal grammar for clarity) is a set of production rules for strings in a formal language.
The rules describe how to form strings from the language's alphabet that are valid according to the language's syntax.
A formal grammar is a set of rules for rewriting strings, along with a "start symbol" from which rewriting starts.
I could not find out what syntactic grammar is.
The lexical features are unigrams, bigrams, and the surface form of the target word, while the syntactic features are part of speech tags and various components from a parse tree. The surface form of a target word may restrict its possible senses.
The categories of English words that are lexical include nouns, adjectives, most verbs, and many adverbs. Lexical meaning is dominant in content words, whereas grammatical meaning is dominant in function words, but in neither is grammatical meaning absent.
What's the Difference Between Syntax and Grammar? Syntax is a subdivision of grammar. Grammar comprises the entire system of rules for a language, including syntax. Syntax deals with the way that words are put together to form phrases, clauses, and sentences.
The main difference between syntax analysis and semantic analysis is that syntax analysis takes the tokens generated by the lexical analysis and generates a parse tree while semantic analysis checks whether the parse tree generated by syntax analysis follows the rules of the language.
A more expansive definition of "syntax" would be the set of all ordered combinations of symbols which form a correct document, in the given language. Thus, "syntactic grammar" can be summarily described as the portion of the language's grammar that describes how various tokens can be ordered, to form meaningful phrases.
Of course this folds back on your provided definition of "lexical grammar", so allow me to highlight the major difference--lexical grammar describes the structure of the lexicon, that is, every token (word) used in the language. Syntactical grammar describes how phrases and documents are formed from those tokens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With