1.2 What Is a Language?

Building Parsers with Java
By Steven  John  Metsker

Table of Contents
Chapter  1.   Introduction


For the purposes of this book, a language is a set of strings. For example,

 {"Hello, World."} 

is a very little language. Another little example is the following:

 {"", "a", "aa", "aaa", ...} 

This language is the set of strings of zero or more a s. The description of this set uses " ... " to mean that the initial pattern continues. The strings that make up a language are the elements of that language. A parser is an object that recognizes the elements of a language. Most of the parsers in this book also build an object as the result of recognizing a language element.

Interesting languages usually contain strings that follow a certain pattern and are related in some way. For example, the following well-known languages are the subject of many books:

  • Structured Query Language (SQL)

  • Hypertext Markup Language (HTML)

  • Extensible Markup Language (XML)

You can think of these languages as specifying patterns of admissible text. In terms of sets, SQL is the language that contains all valid SQL strings. Similarly, Java as a language is the set of strings that are valid Java classes and interfaces. Every string either defines or does not define a valid Java class.

Java is different from these three languages in that it is a programming language ”a language that is geared toward execution on a computer. In addition to Java, popular examples include Basic, C, C++, and Smalltalk.

Famous languages tend to be large, difficult to implement, and subject to standardization and control. These features of famous languages can obscure how effective little languages can be. Unlike famous languages, little languages tend to be small, easy to implement, and subject to your own control.


Building Parsers with Java
Building Parsers With Javaв„ў
ISBN: 0201719622
EAN: 2147483647
Year: 2000
Pages: 169

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net