dannypsnl / typed-nanopass

rebuild nanopass with typed supports
Apache License 2.0
11 stars 0 forks source link

define parser #4

Closed dannypsnl closed 1 year ago

dannypsnl commented 2 years ago

Two options

  1. macro: define-parser
  2. preference subform for define-language like define-language L0 #:with parser

The result function should be able to convert s-expression into language structures.

Draft:

(define-language arith
  #:with-parser
  (terminals (Number (n)))
  (Expr (e) 
        ,n
        (+ ,e ,e))

(parse-arith '(+ (+ 1 2) 3))
;=> (arith:Expr:+ (arith:Expr:+ 1 2) 3)