The cmu-infix Reference Manual

This is the cmu-infix Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 16:04:35 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cmu-infix

Mathematical infix notation for Common Lisp.

Maintainer

Robert Smith <>

Author

Mark Kantrowitz

License

Custom (See LICENSE.txt)

Dependency

named-readtables (system).

Source

cmu-infix.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cmu-infix/cmu-infix.asd

Source

cmu-infix.asd.

Parent Component

cmu-infix (system).

ASDF Systems

cmu-infix.


3.1.2 cmu-infix/package.lisp

Source

cmu-infix.asd.

Parent Component

cmu-infix (system).

Packages

cmu-infix.


3.1.3 cmu-infix/cmu-infix.lisp

Dependency

package.lisp (file).

Source

cmu-infix.asd.

Parent Component

cmu-infix (system).

Public Interface

string->prefix (function).

Internals

4 Packages

Packages are listed by definition order.


4.1 cmu-infix

Package holding the readtable designator for mathematical infix notation.

The following two tables enumerate the supported operators along with their precedence.

Operators:

NOTE: == is equality, = is assignment (C-style).

\ quoting character: x\-y –> x-y
! lisp escape !(foo bar) –> (foo bar)
; comment
x = y assignment (setf x y)
x += y increment (incf x y)
x -= y decrement (decf x y)
x *= y multiply and store (setf x (* x y)) x /= y divide and store (setf x (/ x y)) x|y bitwise logical inclusive or (logior x y) x^y bitwise logical exclusive or (logxor x y) x&y bitwise logical and (logand x y) x<<y left shift (ash x y)
x>>y right shift (ash x (- y)) ~x ones complement (unary) (lognot x)
x and y conjunction (and x y)
x && y conjunction (and x y)
x or y disjunction (or x y)
x || y disjunction (or x y)
not x negation (not x)
x^^y exponentiation (expt x y)
x,y sequence (progn x y) (x,y) sequence (progn x y) also parenthesis (x+y)/z –> (/ (+ x y) z) f(x,y) functions (f x y)
a[i,j] array reference (aref a i j) x+y x*y arithmetic (+ x y) (* x y) x-y x/y arithmetic (- x y) (/ x y) -y value negation (- y)
x % y remainder (mod x y)
x<y x>y inequalities (< x y) (> x y) x <= y x >= y inequalities (<= x y) (>= x y) x == y equality (= x y)
x != y equality (not (= x y)) if p then q conditional (when p q)
if p then q else r conditional (if p q r)

Precedence:

The following precedence conventions are obeyed by the infix operators: [ ( !
^^
~
* / %
+ -
<< >>
< == > <= != >=
&
^
|
not
and
or
= += -= *= /=
,
if
then else
] )

Note that logical negation has lower precedence than numeric comparison so that "not a<b" becomes (not (< a b)), which is different from the C precedence conventions. You can change the precedence conventions by modifying the value of the variable *operator-ordering*.

Source

package.lisp.

Use List
  • common-lisp.
  • editor-hints.named-readtables.
Public Interface

string->prefix (function).

Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: string->prefix (string)

Convert a string to a prefix s-expression using the infix reader. If the argument is not a string, just return it as is.

Package

cmu-infix.

Source

cmu-infix.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *infix-readtable*
Package

cmu-infix.

Source

cmu-infix.lisp.

Special Variable: *normal-readtable*
Package

cmu-infix.

Source

cmu-infix.lisp.

Special Variable: *operator-ordering*

Ordered list of operators of equal precedence.

Package

cmu-infix.

Source

cmu-infix.lisp.

Special Variable: *peeked-token*
Package

cmu-infix.

Source

cmu-infix.lisp.

Special Variable: *right-associative-operators*
Package

cmu-infix.

Source

cmu-infix.lisp.

Special Variable: *token-infix-operator-table*
Package

cmu-infix.

Source

cmu-infix.lisp.

Special Variable: *token-operators*
Package

cmu-infix.

Source

cmu-infix.lisp.

Special Variable: *token-prefix-operator-table*
Package

cmu-infix.

Source

cmu-infix.lisp.


5.2.2 Macros

Macro: define-character-tokenization (char function)
Package

cmu-infix.

Source

cmu-infix.lisp.

Macro: define-token-operator (operator-name &key prefix infix)
Package

cmu-infix.

Source

cmu-infix.lisp.

Macro: infix-error (format-string &rest args)
Package

cmu-infix.

Source

cmu-infix.lisp.


5.2.3 Ordinary functions

Function: apply-token-infix-operator (token left stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: apply-token-prefix-operator (token stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: fancy-number-format-p (left operator stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: gather-superiors (previous-operator stream)

Gathers an expression whose operators all exceed the precedence of the operator to the left.

Package

cmu-infix.

Source

cmu-infix.lisp.

Function: get-first-token (stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: get-next-token (stream left)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: get-token-infix-operator (token)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: get-token-prefix-operator (token)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: infix-read-delimited-list (end-token delimiter-token stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: infix-reader (stream subchar arg)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: operator-lessp (op1 op2)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: operator-right-associative-p (operator)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: peek-token (stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: post-process-expression (expression)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: read-infix (stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: read-regular (stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: read-token (stream)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: same-operator-p (x y)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: same-token-p (x y)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: token-operator-p (token)
Package

cmu-infix.

Source

cmu-infix.lisp.

Function: valid-numberp (string)
Package

cmu-infix.

Source

cmu-infix.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   D   F   G   I   M   O   P   R   S   T   V  
Index Entry  Section

A
apply-token-infix-operator: Private ordinary functions
apply-token-prefix-operator: Private ordinary functions

D
define-character-tokenization: Private macros
define-token-operator: Private macros

F
fancy-number-format-p: Private ordinary functions
Function, apply-token-infix-operator: Private ordinary functions
Function, apply-token-prefix-operator: Private ordinary functions
Function, fancy-number-format-p: Private ordinary functions
Function, gather-superiors: Private ordinary functions
Function, get-first-token: Private ordinary functions
Function, get-next-token: Private ordinary functions
Function, get-token-infix-operator: Private ordinary functions
Function, get-token-prefix-operator: Private ordinary functions
Function, infix-read-delimited-list: Private ordinary functions
Function, infix-reader: Private ordinary functions
Function, operator-lessp: Private ordinary functions
Function, operator-right-associative-p: Private ordinary functions
Function, peek-token: Private ordinary functions
Function, post-process-expression: Private ordinary functions
Function, read-infix: Private ordinary functions
Function, read-regular: Private ordinary functions
Function, read-token: Private ordinary functions
Function, same-operator-p: Private ordinary functions
Function, same-token-p: Private ordinary functions
Function, string->prefix: Public ordinary functions
Function, token-operator-p: Private ordinary functions
Function, valid-numberp: Private ordinary functions

G
gather-superiors: Private ordinary functions
get-first-token: Private ordinary functions
get-next-token: Private ordinary functions
get-token-infix-operator: Private ordinary functions
get-token-prefix-operator: Private ordinary functions

I
infix-error: Private macros
infix-read-delimited-list: Private ordinary functions
infix-reader: Private ordinary functions

M
Macro, define-character-tokenization: Private macros
Macro, define-token-operator: Private macros
Macro, infix-error: Private macros

O
operator-lessp: Private ordinary functions
operator-right-associative-p: Private ordinary functions

P
peek-token: Private ordinary functions
post-process-expression: Private ordinary functions

R
read-infix: Private ordinary functions
read-regular: Private ordinary functions
read-token: Private ordinary functions

S
same-operator-p: Private ordinary functions
same-token-p: Private ordinary functions
string->prefix: Public ordinary functions

T
token-operator-p: Private ordinary functions

V
valid-numberp: Private ordinary functions