From 6c75b60d1b86c93f73bd0f00f9e532c155df20e2 Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Tue, 23 Aug 2011 23:43:23 -0600 Subject: [PATCH] [honu] add assignment operator --- collects/honu/core/private/honu2.rkt | 7 +++++++ collects/honu/core/read.rkt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/collects/honu/core/private/honu2.rkt b/collects/honu/core/private/honu2.rkt index d065506d3d..c7e4d0f7d9 100644 --- a/collects/honu/core/private/honu2.rkt +++ b/collects/honu/core/private/honu2.rkt @@ -136,6 +136,13 @@ [right right]) #'(right left)))) +(provide honu-assignment) +(define-honu-operator/syntax honu-assignment 0.0001 'left + (lambda (left right) + (with-syntax ([left left] + [right right]) + #'(set! left right)))) + (define-binary-operator honu-+ 1 'left +) (define-binary-operator honu-- 1 'left -) (define-binary-operator honu-* 2 'left *) diff --git a/collects/honu/core/read.rkt b/collects/honu/core/read.rkt index 846b1dfa33..cdc4318760 100644 --- a/collects/honu/core/read.rkt +++ b/collects/honu/core/read.rkt @@ -34,7 +34,7 @@ (:~ #\"))) (define-lex-abbrev string (:: #\" (:* string-character) #\")) (define-lex-abbrev operator (:or "+" "=" "*" "/" "-" "^" "||" "|" "&&" "<=" - ">=" "<-" "<" ">" "!" "::")) + ">=" "<-" "<" ">" "!" "::" ":=")) (define-lex-abbrev block-comment (:: "/*" (complement (:: any-string "*/" any-string)) "*/"))