jsonic wip
This commit is contained in:
parent
88aa36b2a6
commit
6fd5ba0218
16
jsonic/lexer.rkt
Normal file
16
jsonic/lexer.rkt
Normal 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
4
jsonic/parser.rkt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#lang brag
|
||||||
|
jsonic-program: (jsonic-char | jsonic-sexp)*
|
||||||
|
jsonic-char: CHAR-TOK
|
||||||
|
jsonic-sexp: SEXP-TOK
|
||||||
Loading…
x
Reference in New Issue
Block a user