jsonic wip

This commit is contained in:
Peter Hart 2020-03-08 15:39:40 -04:00
parent 88aa36b2a6
commit 6fd5ba0218
2 changed files with 20 additions and 0 deletions

16
jsonic/lexer.rkt Normal file
View File

@ -0,0 +1,16 @@
#lang br/quicklang
(require brag/support)
(define (make-tokenizer port)
(define (next-token)
(define jsonic-lexer
(lexer
[(from/to "//" "\n") (next-token)]
[(from/to "@$" "$@")
(token 'SEXP-TOK (trim-ends "@$" lexeme "$@"))]
[any-char (token 'CHAR-TOK lexeme)]))
(jsonic-lexer port))
next-token)
(provide make-tokenizer)

4
jsonic/parser.rkt Normal file
View File

@ -0,0 +1,4 @@
#lang brag
jsonic-program: (jsonic-char | jsonic-sexp)*
jsonic-char: CHAR-TOK
jsonic-sexp: SEXP-TOK