@@ -428,6 +428,11 @@ export class SchemeParser implements Parser {
428428 private parseNormalGroup ( group : Group ) : Expression {
429429 // it is an error if the group is empty in a normal context
430430 if ( group . length ( ) === 0 ) {
431+ if ( this . chapter >= MACRO_CHAPTER ) {
432+ // disable any verification for the empty group
433+ // the CSEP machine will verify its validity
434+ return new Atomic . Nil ( group . location ) ;
435+ }
431436 throw new ParserError . ExpectedFormError (
432437 this . source ,
433438 group . location . start ,
@@ -887,6 +892,19 @@ export class SchemeParser implements Parser {
887892 * @returns
888893 */
889894 private parseLet ( group : Group ) : Extended . Let {
895+ if ( this . chapter >= MACRO_CHAPTER ) {
896+ // disable any verification for the let expression
897+ const groupItems = group . unwrap ( ) . slice ( 1 ) ;
898+ groupItems . forEach ( item => {
899+ this . parseExpression ( item ) ;
900+ } ) ;
901+ return new Extended . Let (
902+ group . location ,
903+ [ ] ,
904+ [ ] ,
905+ new Atomic . Identifier ( group . location , "undefined" )
906+ ) ;
907+ }
890908 // Form: (let ((<identifier> <value>)*) <body>+)
891909 // ensure that the group has at least 3 elements
892910 if ( group . length ( ) < 3 ) {
@@ -1003,6 +1021,19 @@ export class SchemeParser implements Parser {
10031021 * @returns
10041022 */
10051023 private parseExtendedCond ( group : Group ) : Extended . Cond {
1024+ if ( this . chapter >= MACRO_CHAPTER ) {
1025+ // disable any verification for the cond expression
1026+ const groupItems = group . unwrap ( ) . slice ( 1 ) ;
1027+ groupItems . forEach ( item => {
1028+ this . parseExpression ( item ) ;
1029+ } ) ;
1030+ return new Extended . Cond (
1031+ group . location ,
1032+ [ ] ,
1033+ [ ] ,
1034+ new Atomic . Identifier ( group . location , "undefined" )
1035+ ) ;
1036+ }
10061037 // Form: (cond (<pred> <body>)*)
10071038 // | (cond (<pred> <body>)* (else <val>))
10081039 // ensure that the group has at least 2 elements
@@ -1248,6 +1279,17 @@ export class SchemeParser implements Parser {
12481279 * @returns
12491280 */
12501281 private parseDelay ( group : Group ) : Extended . Delay {
1282+ if ( this . chapter >= MACRO_CHAPTER ) {
1283+ // disable any verification for the delay expression
1284+ const groupItems = group . unwrap ( ) . slice ( 1 ) ;
1285+ groupItems . forEach ( item => {
1286+ this . parseExpression ( item ) ;
1287+ } ) ;
1288+ return new Extended . Delay (
1289+ group . location ,
1290+ new Atomic . Identifier ( group . location , "undefined" )
1291+ ) ;
1292+ }
12511293 // Form: (delay <expr>)
12521294 // ensure that the group has 2 elements
12531295 if ( group . length ( ) !== 2 ) {
@@ -1439,7 +1481,8 @@ export class SchemeParser implements Parser {
14391481 pattern instanceof Atomic . Symbol ||
14401482 pattern instanceof Atomic . BooleanLiteral ||
14411483 pattern instanceof Atomic . NumericLiteral ||
1442- pattern instanceof Atomic . StringLiteral
1484+ pattern instanceof Atomic . StringLiteral ||
1485+ pattern instanceof Atomic . Nil
14431486 ) {
14441487 return true ;
14451488 } else {
@@ -1524,7 +1567,8 @@ export class SchemeParser implements Parser {
15241567 template instanceof Atomic . Symbol ||
15251568 template instanceof Atomic . BooleanLiteral ||
15261569 template instanceof Atomic . NumericLiteral ||
1527- template instanceof Atomic . StringLiteral
1570+ template instanceof Atomic . StringLiteral ||
1571+ template instanceof Atomic . Nil
15281572 ) {
15291573 return true ;
15301574 } else {
0 commit comments