initial commit.
This commit is contained in:
commit
db4fa87d4b
3 changed files with 194 additions and 0 deletions
45
README.md
Normal file
45
README.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
at-expr for guile. Almost.
|
||||
|
||||
Use like this:
|
||||
|
||||
``` scheme
|
||||
#@list[1 2 3]{This is the fun part.
|
||||
It also handles newlines and indentation.}
|
||||
|
||||
;;=> (1 2 3 "This is the fun part." "\n" "It also handles newlines and indentation.")
|
||||
```
|
||||
|
||||
It differs from Racket's at-expr in that it is not a proper reader extension, but a hack using guile's read-hash-extend. I never had the time nor energy to find all the edge cases and work them out, so no fancy things.
|
||||
|
||||
# One weird thing
|
||||
|
||||
``` scheme
|
||||
;; Any at-expr in the squiggly part of an at-expr should start without the #.
|
||||
#@list{Here I want proper scheme expr: @(+ 1 2).
|
||||
Look. No pound sign.}
|
||||
;; ("Here I want proper scheme expr: " 3 ". " "\n" "Look. No pound sign.")
|
||||
```
|
||||
|
||||
# grammar
|
||||
|
||||
```
|
||||
@<cmd><[args ...]{squiggly ...}
|
||||
Where all parts are optional, but you have to have at least one.
|
||||
|
||||
cmd and args are read with guile's normal reader. Squiggly is special. Any normal text between { and } is read as a string. If an @ is found, whatever follows is interpreted as an at-expr. To write a literal at, you have to do @"@".
|
||||
|
||||
Examples:
|
||||
|
||||
#@list(1 2 3) ;;=> (list 1 2 3)
|
||||
#@list{My name is: @(read)} => (list "My name is: " (read))
|
||||
#@+(1 2) ;; => (+ 1 2)
|
||||
#@list{I can handle
|
||||
source code indentation.
|
||||
This line is indented by one space.}
|
||||
;; => ("I can handle" "\n" "source code indentation." "\n" " This line is indented by one space.")
|
||||
|
||||
```
|
||||
|
||||
# Licence
|
||||
|
||||
Public domain or CC0 at your discretion.
|
Loading…
Add table
Add a link
Reference in a new issue