From: Mike D. Lowis Date: Thu, 12 Jul 2012 20:58:46 +0000 (-0400) Subject: Added comment to parser describing the EBNF grammar I hope to implement X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9cf07f59514b7c48ee31036b729d50736cf9c0db;p=archive%2Fdlang-scm.git Added comment to parser describing the EBNF grammar I hope to implement --- diff --git a/source/parser.scm b/source/parser.scm index bdcd7a0..e64f670 100644 --- a/source/parser.scm +++ b/source/parser.scm @@ -1,5 +1,22 @@ (declare (unit parser) (uses buf)) +; Formal EBNF Syntax: +; +; Program := Expression* +; +; Expression := CoreForm +; | BasicExpr +; | BasicExpr ArgList +; CoreForm +; +; BasicExpr := '(' Expression Operator Expression ')' +; | Literal +; +; Operator +; +; Literal := ID | CHAR | STRING | SYMBOL | NUMBER +; +; ArgList := '(' Expression (',' Expression)* ')' (define (dlang/program in) (define result '()) @@ -21,7 +38,8 @@ (define (dlang/core-form in) '()) (define (dlang/basic-expr in) - (if (buf-lookahead! in 1) + (define tok (buf-lookahead! in 1)) + (if (equal? 'lpar (token-type tok)) (dlang/operator-app in) (dlang/literal in)))