Skip to content

Commit c32017e

Browse files
authored
Merge pull request #20 from clojure-emacs/remove-parseedn
Remove parseedn files
2 parents a82f229 + 7fba162 commit c32017e

File tree

7 files changed

+27
-618
lines changed

7 files changed

+27
-618
lines changed

DESIGN.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# parseclj Design Goals / Roadmap
22

3-
parseclj is an Emacs Lisp library for parsing Clojure code and EDN data. It
4-
supports several input and output formats, all powered by the same shift-reduce
5-
parser function.
3+
parseclj is an Emacs Lisp library for parsing Clojure code and [EDN
4+
data](https://github.com/edn-format/edn). It supports several input and output
5+
formats, all powered by the same shift-reduce parser function.
66

77
This documents describes the design goals for parseclj, and as such may describe features which are not implemented yet.
88

@@ -39,7 +39,7 @@ On the other hand Emacs supports strings/buffers with arbitrary encoding, on the
3939

4040
## Architecture
4141

42-
The implementation is implemented in three parts: a lexer, a parser, and multiple reducers.
42+
The implementation is implemented in three parts: a lexer, a parser, and [multiple reducers](#multiple-reducers).
4343

4444
### Lexer
4545

@@ -214,7 +214,17 @@ Unmatched closing delimiter:
214214

215215
In many cases it will be desirable to "fail fast", and raise an error as soon as a syntax error is encountered. A `reduce-branch` function can do so if it wishes by checking its input sequence for raw tokens, and raising an error if any are present.
216216

217-
## EDN vs Clojure
217+
## Multiple Reducers
218+
219+
While the shift-reduce parser parses input, it reduces parsed values (leafs tokens and collections) using "reducing functions". These functions are in charge of giving actual meaning to the parsed data.
220+
221+
Currently, there are two sets of reducing functions implemented: one set that reduces parsed values to AST data structures, and another one that reduces to Emacs Lisp values.
222+
223+
The AST reducing functions are part of [`parseclj`](https://github.com/clojure-emacs/parseclj), while the Emacs Lisp reducing functions are separated into a differente package called [`parseedn`](https://github.com/clojure-emacs/parseedn).
224+
225+
To understand why these two set of reducing functions are separated, it's important to look at the difference between EDN and Clojure, and also between Emacs Lisp elements and EDN elements.
226+
227+
### EDN vs Clojure
218228

219229
EDN syntax is a subset of Clojure syntax used for representing data (as opposed to code).
220230

@@ -223,7 +233,7 @@ Several constructs that are common in Clojure code are not valid in EDN. This in
223233
- quoting, syntax quoting, syntax quote splicing, etc.
224234
- read time evaluation with `#=(,,,)`
225235

226-
## Dealing with tagged literals
236+
### Dealing with tagged literals
227237

228238
EDN/Clojure syntax is extensible. Values can be prefixed with user-provided tags, which indicates they need to be transformed after reading by a registered handler function.
229239

@@ -233,7 +243,7 @@ The EDN parser functions will take an optional tag handler function. This functi
233243

234244
When parsing code to an AST the situation is different, here tags simply become part of the AST, without caring about their semantics.
235245

236-
## Representing EDN as Emacs Lisp values
246+
### Representing EDN as Emacs Lisp values
237247

238248
See also the section at the top regarding differences between Clojure's data types vs those available in Emacs Lisp.
239249

@@ -246,11 +256,11 @@ These are the choices that the edn.el library has made:
246256
- represent characters as integers, *but* parse `\newline` `\return` `\space` and `\tab` as the symbols `'newline` `'return` etc.
247257
- parse `true` as `t`, `nil` and `false` as `nil`.
248258

249-
### Differences with EDN.el
259+
#### Differences with EDN.el
250260

251261
At the moment the `parseedn-*` copy the parsing behavior of edn.el, *except* that the character literals `\newline`, `\return`, `\space`, and `\tab` are parsed to their character code (10, 13, 32, and 9 respectively), instead of to symbols.
252262

253-
## AST
263+
### AST
254264

255265
An AST (abstract syntax tree) is a tree structure made up of nodes. A node looks like this
256266

@@ -274,6 +284,8 @@ Non-leaf nodes contain a list of `:children`.
274284

275285
## Public API
276286

287+
> Disclaimer: outdated information -- this API has been deprecated in favor of [Alternative Package Layout](#alternative-package-layout), and it's only kept here for historical purposes.
288+
277289
parseclj provides three "parse modes"
278290

279291
- `edn` meant for parsing data, it parses EDN to emacs lisp data
@@ -432,7 +444,7 @@ corresponding type in Emacs. `nil' and `false' form a
432444
particularly poignant case, both are converted to `nil'.")
433445
```
434446

435-
**Package**: parseedn
447+
**Package**: [parseedn](https://github.com/clojure-emacs/parseedn)
436448

437449
- file: parseedn.el
438450

README.md

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Build Status](https://travis-ci.org/clojure-emacs/parseclj.svg?branch=master)](https://travis-ci.org/clojure-emacs/parseclj)
22

3-
# EDN reader and Clojure parser for Emacs Lisp
3+
# Clojure parser for Emacs Lisp
44

55
`parseclj` is an Emacs Lisp library for parsing Clojure code and [EDN
66
data](https://github.com/edn-format/edn). It supports several input and output
@@ -25,12 +25,9 @@ You can just copy-paste this code into your Emacs init file:
2525

2626
## Usage
2727

28-
`parseclj` is actually a compound of two libraries:
29-
30-
- `parseedn`: An EDN reader that transforms EDN to Emacs Lisp data structures.
31-
- `parseclj`: A Clojure parser that returns an
32-
[AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) that, for example,
33-
given as input `(1 2 [:a :b :c])`, it looks like this:
28+
`parseclj` contains function that return an
29+
[AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) that, for example,
30+
given as input `(1 2 [:a :b :c])`, it looks like this:
3431

3532
``` emacs-lisp
3633
((:node-type . :root)
@@ -61,7 +58,7 @@ You can just copy-paste this code into your Emacs init file:
6158
(:value . :c))))))))
6259
```
6360

64-
In order to use any of them, you first need to require it:
61+
In order to use any of these functions, you first need to require it:
6562

6663
```emacs-lisp
6764
(require 'parseclj)
@@ -71,8 +68,6 @@ In order to use any of them, you first need to require it:
7168

7269
And then you will have the following functions at your disposal:
7370

74-
### parseclj
75-
7671
- `parseclj-parse-clojure` &rest string-and-options
7772

7873
When no arguments, parses Clojure source code into an AST and returns it.
@@ -107,26 +102,6 @@ And then you will have the following functions at your disposal:
107102

108103
Transfrom the given AST into Clojure source code and returns it as a string.
109104

110-
### parseedn
111-
112-
- `parseedn-read`
113-
114-
Read content from the current buffer as EDN and transforms it into an Emacs
115-
Lisp value.
116-
117-
- `parseedn-read-str` str
118-
119-
Read STR as EDN and transfroms it into an Emacs Lisp value.
120-
121-
- `parseedn-print` datum
122-
123-
Inserts DATUM as EDN Into the current buffer. DATUM can be any Emacs Lisp
124-
value.
125-
126-
- `parseedn-print-str` datum
127-
128-
Returns a string containing DATUM as EDN. DATUM can be any Emacs Lisp
129-
value.
130105

131106
## License
132107

benchmark/speed-comparison.el

Lines changed: 0 additions & 26 deletions
This file was deleted.

parseclj-ast.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
(require 'subr-x)
3131
(require 'parseclj-lex)
32-
(require 'parseedn)
3332

3433
;; AST helper functions
3534

parseedn.el

Lines changed: 0 additions & 188 deletions
This file was deleted.

0 commit comments

Comments
 (0)