Strings and Concrete Syntax Flashcards
What is an alphabet
What is a string (and empty string)
What is a language
What is a substring
How does concatenation and k-fold concat work
What is the length of a string
What is a (concrete) syntax
A description of which strings constitute a valid sentence in the language, or more specifically for us, a valid program.
What is a grammar
A formal (often context free) definition/way of describing the syntax of a language.
How are grammars defined (using numbered rules)
Each line is called a production rule
How are grammars defined (compactly organised via their rule)
What is a non-terminal symbol of a grammar
Symbols which have a rule and can be recursively replaced.
In the above example {A, F, L} are non-terminal symbols
What are terminal symbols
Terminal symbols are final values for a derivation of a grammar and are part of its alphabet
In the above example {+,-,*,(,),n} (where is is any natural number) are terminal symbols
What does the process of deriving an expression from a grammar look like
Start with the ‘start symbol’ and recusively replace the terms until all are terminal symbols
In the Arithmatic grammar, what does the non-terminal symbol ‘A’ represent?
In the Arithmatic grammar, what does the non-terminal symbol ‘L’ represent?