]> git.mdlowis.com Git - archive/dlang-scm.git/commitdiff
Added comment to parser describing the EBNF grammar I hope to implement
authorMike D. Lowis <mike@mdlowis.com>
Thu, 12 Jul 2012 20:58:46 +0000 (16:58 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Thu, 12 Jul 2012 20:58:46 +0000 (16:58 -0400)
source/parser.scm

index bdcd7a0050fda1e956094dbad804656b4a931e30..e64f6709870333c3e274237d086828c4d3327efe 100644 (file)
@@ -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)))