CMPT 120 Chapter Notes - Chapter 1: Formal Language, Chemical Formula, Parsing

34 views2 pages
meghan78 and 39786 others unlocked
CMPT 120 Full Course Notes
29
CMPT 120 Full Course Notes
Verified Note
29 documents

Document Summary

Formal languages tend to have strict syntax rules that govern the structure of statements. For example, in mathematics the statement 3 + 3 = 6 has correct syntax, but 3+ = 3 does not. In chemistry h2o is a syntactically correct formula, but 2zz is not. Syntax rules come in two flavors, pertaining to tokens and structure. Tokens are the basic elements of the language, such as words, numbers, and chemical elements. One of the problems with 3+ = 3 is that $ is not a legal token in mathematics (at least as far as i know). Similarly, 2zz is not legal because there is no element with the abbreviation zz. The second type of syntax rule pertains to the way tokens are combined. The equation 3+ = 3 is illegal because even though + and = are legal tokens, you can"t have one right after the other.

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
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers