It is currently Thu Mar 28, 2024 1:19 pm


All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Unit 2 - Lesson 3: Expressions – Overview
PostPosted: Sun May 29, 2011 8:46 am 
User avatar

Joined: Wed Nov 17, 2010 8:37 am
Posts: 136
Real Name: Terry L. Wiechmann
Began Programming in MUMPS: 0- 0-1971
Because this lesson is very large, it will be given in parts. The diagram shown on the first page of the Expression lesson depicts the structure of an expression as it is defined in the standard. Each level will be presented as a lesson. An overview of each lesson is given below.

The definition of an expression as given by the standard is:

“The expression, expr, is the syntactic element which denotes the execution of a value-producing calculation. Expressions are made up of expression atoms separated by binary, arithmetic, or truth-valued operators.”

The standard goes into great depths to explain the concept. We will not. Let it suffice to say that the expression is very powerful and recursively defined. What is recursion? Simply stated, it means you can use an expression within an expression.

ASCII Character Set

The expression definition begins with the default ASCII characters set. The MUMPS language is constructed from this character set. By default all MUMPS implementations are based upon the character set. Some implementation permit data that is based on the UTF-8 character set (http://en.wikipedia.org/wiki/UTF-8) which is a requirement if you are going to do Web work. ASCII is a subset of UTF-8.

Data Type: String

MUMPS has one data type, the String. Strings consist of a collection of characters including the empty set. When a string is used within a command context, the context may required the string to produce a numeric value or a truth value. For example, if a string is used within an arithmetic operation, only the leading numbers up to the first non-numeric character will be used in the operation (now review the Teaser in the Extrinsic Variables section of the previous lesson). If the string is used in a truth value producing context, a zero (false) or nonzero(true) number will be produced. In other words, what a string evaluates to depends upon the context of evaluation.

Symbol Names

MUMPS strings are associated with names producing Name Value relationships. There are three levels of Name Value types: Symbols, Arrays and Functions. Symbols are also referred to as variables when the value is settable (can change). Symbols consist of:
  • Name=String – Simple binding of a string to a name forming a local symbol.
  • ^Name=String – A name preceded by a carat (up arrow) character that forms a simple binding of a string to a name forming a global (persistent) symbol.
  • $Name=String – An name preceded by a dollar sign character that produces a value known as an Intrinsic Symbol. They produce system information.
  • $$Name=String – A name preceded by two dollar signs that produces a string value known as an Extrinsic Symbol.
  • ^$Name=String – A name preceded by a carat character and dollar sign that produces a value. These are referred to as Structured Special Variables and are implemented as arrays. They produce system status information.
Array Nodes

Arrays extend the concept of symbol names by adding subscripting capabilities. For example:

^PAT(345678,”Name”)=”Doe, John”

This is a persistent array (global) node whose first subscript is the number 345678 and second subscript is the literal “Name”. This node is bound to the string “Doe, John”

Arrays form the basis for the MUMPS database. We will spend a great deal of time with them.

Functions

Functions are used to produce values given one or more input parameters. There are a number of functions that need to be covered – all of them important.

Indirection

The MUMPS language is a powerful string handing language. However, without Indirection, you would be confined to writing what I call “literal” programs. That is, if you had to write a patient data entry program and an accounts receivable entry program, you would have to literally write two complete sets of programs. Indirection permits you to implement the commonality between the two programs as one set of code that is typically table driven. Programs like File Manager and EsiObjects would be extremely hard (if not impossible) to write without the aid of Indirection.

Having said that, working with Indirection can be confusing and abstract. We will not elaborate on it in this course. It is elaborated upon greatly (almost exclusively) in the MUMPS Programming II course.

Operators

Operators are the glue that pulls together the language elements listed above to form an expression. We will cover and use them extensively.

_________________
Terry L. Wiechmann


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net