This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-03
Channels
- # announcements (35)
- # aws (20)
- # babashka (4)
- # beginners (88)
- # cider (9)
- # clara (1)
- # clj-kondo (6)
- # cljsrn (3)
- # clojure (107)
- # clojure-dev (7)
- # clojure-europe (99)
- # clojure-nl (3)
- # clojure-spec (9)
- # clojure-uk (2)
- # clojurescript (28)
- # core-async (53)
- # cursive (11)
- # datascript (1)
- # datomic (2)
- # emacs (20)
- # fulcro (3)
- # graalvm (4)
- # holy-lambda (18)
- # jobs (1)
- # kaocha (7)
- # leiningen (2)
- # lsp (25)
- # luminus (1)
- # membrane-term (52)
- # missionary (8)
- # nextjournal (19)
- # off-topic (16)
- # other-languages (3)
- # podcasts-discuss (2)
- # polylith (23)
- # re-frame (4)
- # reclojure (6)
- # remote-jobs (1)
- # rewrite-clj (36)
- # ring (1)
- # sci (10)
- # shadow-cljs (7)
- # spacemacs (5)
- # sql (20)
- # uncomplicate (1)
- # vscode (3)
- # xtdb (27)
I posted the following in #clojure , and @hiredman pointed out clojure-spec satisfies the properties
Consider the problem of String -> AbstractSyntaxTree. Solving this problem is called Parsing, and we can solve it via Regex + LL / LALR / Peg / Parsec / ... . In particular, we can view Regex / Peg as "DSLs" for String -> AbstractSyntaxTree
Now, suppose we are trying to define a DSL -- which can be viewed as a subset of s-exprs. For example, Scheme is a "s-expr DSL"; Lisp is a "s-expr DSL", edn is a "s-expr DSL", clojure is a "s-expr DSL" -- in all 4 cases, all valid data values look like s-exprs.
Question: What is the Regex / Peg equiv for doing "s-expr -> DSLs" ? I.e. what is a "pattern description language" for specifying what subset of s-exprs are valid exprs in the DSL ?
A followup to this then is: Regex is backed by DFA / NFA theory. Other parsing techniques is backed by (limited subset of) Context Free Grammars. Is there a "theory" behind clojure-spec, or is it driven largely by battled tested useful tactics ?
the theory is basically the same as parsing where parsing is sort of logically defined over any sequence of tokens of any type, but we usually think of parsing as over a sequence of character or string tokens