@@ -4,7 +4,7 @@ import { List } from '../stdlib/list'
44import { _Symbol } from '../alt-langs/scheme/scm-slang/src/stdlib/base'
55import { is_number , SchemeNumber } from '../alt-langs/scheme/scm-slang/src/stdlib/core-math'
66import { Context } from '..'
7- import { Control , Pattern , Stash } from './interpreter'
7+ import { Control , Transformers , Stash } from './interpreter'
88import { getVariable , handleRuntimeError } from './utils'
99import {
1010 Transformer ,
@@ -42,10 +42,10 @@ export class Eval extends Function {
4242 }
4343}
4444
45- export const csep_eval = Eval . get ( )
45+ export const cset_eval = Eval . get ( )
4646
4747export function isEval ( value : any ) : boolean {
48- return value === csep_eval
48+ return value === cset_eval
4949}
5050
5151// helper function to check if a value is a list.
@@ -84,15 +84,15 @@ export function schemeEval(
8484 context : Context ,
8585 control : Control ,
8686 stash : Stash ,
87- patterns : Pattern ,
87+ transformers : Transformers ,
8888 isPrelude : boolean
8989) {
9090 // scheme CSE machine will only ever encounter
9191 // lists or primitives like symbols, booleans or strings.
9292 // if its a list, we can parse the list and evaluate each item as necessary
9393 // if its a symbol, we can look up the symbol in the environment.
9494 // for either of these operations, if our list matches some pattern in
95- // the P component, then we can apply the corresponding rule.
95+ // the T component, then we can apply the corresponding rule.
9696
9797 // if its a number, boolean, or string, we can just shift the value
9898 // onto the stash.
@@ -109,14 +109,14 @@ export function schemeEval(
109109 // it should match some symbol "define", "set", "lambda", etc...
110110 // or if it doesn't match any of these, then it is a function call.
111111 if ( elem instanceof _Symbol ) {
112- // check if elem matches any defined syntax in the P component.
112+ // check if elem matches any defined syntax in the T component.
113113 // if it does, then apply the corresponding rule.
114- if ( patterns . hasPattern ( elem . sym ) ) {
114+ if ( transformers . hasPattern ( elem . sym ) ) {
115115 // get the relevant transformers
116- const transformers : Transformer [ ] = patterns . getPattern ( elem . sym )
116+ const transformerList : Transformer [ ] = transformers . getPattern ( elem . sym )
117117
118118 // find the first matching transformer
119- for ( const transformer of transformers ) {
119+ for ( const transformer of transformerList ) {
120120 // check if the transformer matches the list
121121 try {
122122 if ( match ( command , transformer . pattern , transformer . literals ) ) {
@@ -468,14 +468,14 @@ export function schemeEval(
468468 const rules = syntaxRulesList . slice ( 2 )
469469 // rules are set as a list of patterns and templates.
470470 // we need to convert these into transformers.
471- const transformers : Transformer [ ] = rules . map ( rule => {
471+ const transformerList : Transformer [ ] = rules . map ( rule => {
472472 const ruleList = flattenList ( rule )
473473 const pattern = ruleList [ 0 ]
474474 const template = ruleList [ 1 ]
475475 return new Transformer ( literals , pattern , template )
476476 } )
477477 // now we can add the transformers to the patterns component.
478- patterns . addPattern ( syntaxName . sym , transformers )
478+ transformers . addPattern ( syntaxName . sym , transformerList )
479479 return
480480 case 'syntax-rules' :
481481 // syntax-rules is a special form that is used to define
@@ -503,12 +503,12 @@ export function schemeEval(
503503 control . push ( appln as es . CallExpression )
504504 return
505505 } else if ( command instanceof _Symbol ) {
506- if ( patterns . hasPattern ( command . sym ) ) {
506+ if ( transformers . hasPattern ( command . sym ) ) {
507507 // get the relevant transformers
508- const transformers : Transformer [ ] = patterns . getPattern ( command . sym )
508+ const transformerList : Transformer [ ] = transformers . getPattern ( command . sym )
509509
510510 // find the first matching transformer
511- for ( const transformer of transformers ) {
511+ for ( const transformer of transformerList ) {
512512 // check if the transformer matches the list
513513 try {
514514 if ( match ( command , transformer . pattern , transformer . literals ) ) {
0 commit comments