Appendix E. Production Rules for theRS274/NGC Language
The following is a production rule definition of what combinations of symbols form a valid line of RS274/NGC code. Developers, researchers, and NC programmers and machine operators with computer science backgrounds may find this section useful. NC programmers and machine operators without computer science backgrounds and SAI installers will probably not find it useful.
The term "line" is at the top of the production hierarchy. The productions are arranged alphabetically to make connections easy to trace.
The productions are intended to be unambiguous. That is, no permissible line of code can be interpreted more than one way. To make the productions below entirely unambiguous, it is implicit that if a string of characters that can meet the requirements of an ordinary comment also can be interpreted as a message, that string is a message and not an ordinary comment.
The term comment_character is used in the productions but not defined there. A comment character is any printable character plus space and tab, except for a left parenthesis or right parenthesis. This implies comments cannot be nested.
It is implicit in the production rules that, except inside parentheses, space and tab characters may be ignored, or have been removed by pre-processing.
These production rules do not include constraints implied by the semantics of the Interpreter. Most of the constraints are in terms of combinations of words (as defined below). Many lines of code that are readable under these production rules will not be executable because they violate constraints. Any constraint violation will be detected by the Interpreter and will result in an error message. The error messages are included in Appendix A.
In the productions, a parameter_index is defined as a synonym for real_value. The constraint on a parameter_index is that it must be an integer between 1 and 5399 (inclusive).
The symbols in the productions are mostly standard syntax notation. Meanings of the symbols follow.
= The symbol on the left of the equal sign is equivalent to the expression on the right
. end of production (a production may have several lines)
[ ] zero or one of the expression inside square brackets may occur
{ } zero to many of the expression inside curly braces may occur
( ) exactly one of the expression inside parentheses must occur
Any term in this subsection that is used on the right of an equal sign but is not defined in this subsection (i.e., does not appear on the left in any definition) is defined in the next subsection in terms of characters.
message = left_parenthesis + {white_space} + letter_m + {white_space} + letter_s +
{white_space} + letter_g + {white_space} + comma + {comment_character} +
right_parenthesis .
mid_line_letter = letter_a | letter_b | letter_c| letter_d | letter_f | letter_g | letter_h | letter_i
| letter_j | letter_k | letter_l | letter_m | letter_p | letter_q | letter_r | letter_s | letter_t
| letter_x | letter_y | letter_z .
ordinary_unary_operation =
absolute_value | arc_cosine | arc_sine | cosine | e_raised_to |
fix_down | fix_up | natural_log_of | round | sine | square_root | tangent .
real_number =
[ plus | minus ] +
(( digit + { digit } + [decimal_point] + {digit}) | ( decimal_point + digit + {digit})) .
We have omitted the letters and digits in the list below, since they are all the obvious single characters. For example, one is `1', big_a is `A', and little_a is `a'. The list should be used as if these obvious items were included. Note that not every letter of the alphabet is included (E, O, U, V, and W are omitted).