CS241 Study Guide - Context-Free Grammar, Terminal And Nonterminal Symbols, Parse Tree

38 views6 pages
8 Oct 2014
Course
Professor

Document Summary

A . cfg-r file is a text file representing a context-free grammar followed by several (zero or more) abbreviated reversed right canonical derivations. The format differs from the cfg file format only in that it uses unindented reversed rightmost derivation format. The context-free grammar representation has four components, in order: t, a positive integer giving the number of terminal symbols in the grammar, followed by t lines, each containing the name of a distinct terminal symbol. Each nonterminal symbol may be any string of one or more printable ascii characters, and must not be the same as any terminal symbol. The left-hand-side (lhs) of the rule; a nonterminal symbol. The right-hand-side (rhs) of the rule; zero or more terminal or nonterminal symbols separated from each other, and from the lhs, by a single space. Zero or more derivations immediately follow the context-free grammar. The order and indentation of the lines in the file are defined by the following recursive rules:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents