js-slang icon indicating copy to clipboard operation
js-slang copied to clipboard

Remove src/interpreter/interpreter.ts

Open martin-henz opened this issue 1 year ago • 3 comments

I think src/ec-evaluator is replacing src/interpreter/interpreter.ts, so the latter is dead code.

Background: The interpreter used to be the workhorse implementation in SA, prior to the transpiler. After the transpiler was introduced, it became the implementation behind the environment visualizer. Now the environment visualizer uses ec-evaluator, which means that the interpreter is unemployed.

I suggest we should remove src/interpreter/interpreter.ts from js-slang, and leave some breadcrumbs in the wiki. It is bound to decay over time and cause extra work.

See also https://github.com/source-academy/js-slang/issues/1695

martin-henz avatar Sep 03 '23 02:09 martin-henz

I think we should proceed with the removal. The only references to src/interpreter/interpreter.ts are as follows:

  • https://github.com/source-academy/js-slang/blob/9b489441ac30fab86b5e72cdbd63bb46fc47dfe6/src/interpreter/closure.ts#L15-L20

  • https://github.com/source-academy/js-slang/blob/9b489441ac30fab86b5e72cdbd63bb46fc47dfe6/src/runner/sourceRunner.ts#L115-L127

  • https://github.com/source-academy/js-slang/blob/9b489441ac30fab86b5e72cdbd63bb46fc47dfe6/src/mocks/context.ts#L5

    Perhaps we can just replace this with

    import { createBlockEnvironment } from '../ec-evaluator/utils'
    

How are would it be to completely remove it?

RichDom2185 avatar Jan 23 '24 04:01 RichDom2185

I think we should completely remove it. It's a confusing legacy component at this point. Where are these "mocks" used?

martin-henz avatar Jan 23 '24 04:01 martin-henz

I think we should completely remove it. It's a confusing legacy component at this point. Where are these "mocks" used?

The mocks in the last bullet point are used in test files. I'll make a PR with the necessary changes.

RichDom2185 avatar Jan 23 '24 07:01 RichDom2185