summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-10 22:31:01 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-10 22:31:01 -0700
commitf9c0def5b6049bc600051b928910f724e14af4f5 (patch)
tree03fd27d1f4392d2b04c651646d6d3bec80cbeabe /txr.1
parentd36002e99bd8c844a0f1abdc26e66be7f94409b4 (diff)
downloadtxr-f9c0def5b6049bc600051b928910f724e14af4f5.tar.gz
txr-f9c0def5b6049bc600051b928910f724e14af4f5.tar.bz2
txr-f9c0def5b6049bc600051b928910f724e14af4f5.zip
Dot with no whitespace generates qref syntax.
a.b.(expr ...).c -> (qref a b (expr ...) c) Consing dot requires whitespace. * eval.c (qref_s): New symbol global variable. (eval_init): Initialize qref_s. * eval.h (qref_s): Declared. * parser.l (REQWS): New pattern definition, required whitespace. (grammar): New rules to scan CONSDOT (space required on both sides) and LAMBDOT (space required after). * parser.y (CONSDOT, LAMBDOT): New token types. (list): (. n_expr) rule replaced with LAMBDOT and CONSDOT. (r_exprs): r_exprs . n_expr consing dot rule replaced with CONSDOT. (n_expr): New n_expr . n_expr rule introduced here for producing qref expressions. (yybadtoken): Handle CONSDOT and LAMBDOT. * txr.1: Documented qref dot.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.141
1 files changed, 41 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index a2c1ee32..2954fc4b 100644
--- a/txr.1
+++ b/txr.1
@@ -9181,6 +9181,47 @@ or an atom
as
.codn "(. sym)" .
+.NP* Referencing Dot
+
+A dot token which is flanked by expressions on both sides, without any
+intervening whitespace, is the referencing dot, and not the consing dot.
+The referencing dot is a syntactic sugar which translated to the
+.code qref
+syntax ("quoted ref"), which currently has no assigned meaning and is reserved
+for a future language extension. The referencing dot obeys these
+correspondences:
+
+.cblk
+ ;; a.b may be almost any expressions
+ a.b <--> (qref a b)
+ a.b.c <--> (qref a b c)
+ a.(qref b c) <--> (qref a b c)
+ (qref a b).c <--> (qref (qref a b) c)
+.cble
+
+That is to say, this dot operator constructs a
+.code qref
+expression out of its left and right arguments. If the right argument
+of the dot is already a qref expression (whether produced by another instance
+of the dot operator, or expressed directly) it is merged. And the qref dot
+operator is right-to-left associative, so that
+.code a.b.c
+first produces
+.code (qref b c)
+via the right dot, and then
+.code a
+is adjoined into the syntax via the right dot.
+
+Integer tokens cannot be involved in this syntax, because they
+form floating-point constants when juxtaposed with a dot.
+Such ambiguous uses of floating-point tokens are diagnosed as syntax errors:
+
+.cblk
+ (a.4) ;; error: cramped floating-point literal
+ (a .4) ;; good: a followed by 0.4
+.cble
+
+
.NP* Quote and Quasiquote
.meIP >> ' expr