Skip to content

Conversation

TRK95
Copy link
Contributor

@TRK95 TRK95 commented Aug 10, 2025

This PR adds comprehensive Scheme language support to Source Academy, implementing a complete Scheme Chapter 1 interpreter with direct SCM AST parsing (bypassing JavaScript's ES AST) and full integration with the Source Academy conductor system.

Integration Details:

Feature Flag Configuration:
The Scheme language module is available at:

https://trk95.github.io/scm-slang-pages/dist/index.js
This URL can be used in Source Academy's feature flag system to enable/disable Scheme language support.

Key Features Implemented:

Core Language Features (Scheme Chapter 1):
Variable Definitions: (define x 10) and x → 10
Function Definitions: (define (add x y) (+ x y)) and (add 3 4) → 7
Lambda Expressions: (lambda (x y) (+ x y))
Conditional Statements: (if (> 5 3) "yes" "no") → "yes"
Basic Arithmetic: (+ 3 5), (- 10 3), (* 4 2), (/ 8 2)
Comparisons: (> 5 3), (< 3 5), (= 5 5), (>= 5 5), (<= 3 5)
Boolean Operations: (and #t #f), (or #t #f), (not #f)

Technical Implementation:

  • Direct SCM AST Parsing: Parses Scheme code directly into Scheme-specific AST, avoiding JavaScript ES AST conversion
  • CSE Machine: Complete Control-Stash-Environment machine implementation
  • UMD Module Format: Compatible with browser and Node.js environments
  • Conductor Integration: Full integration with Source Academy's conductor system
  • Environment Persistence: Variables and functions persist across evaluations
  • Error Handling: Comprehensive error reporting with line/column information

Architecture:

Independent Module: Self-contained implementation that can be loaded independently
Feature Flag Ready: Can be enabled/disabled via Source Academy's feature flag system
Extensible Design: Easy to add new Scheme features and chapters

@coveralls
Copy link

coveralls commented Aug 10, 2025

Pull Request Test Coverage Report for Build 17544530225

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 7 (14.29%) changed or added relevant lines in 1 file are covered.
  • 13 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+2.4%) to 53.236%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/transpiler/types/nodes/scheme-node-types.ts 1 7 14.29%
Files with Coverage Reduction New Missed Lines %
src/transpiler/types/nodes/scheme-node-types.ts 13 58.19%
Totals Coverage Status
Change from base Build 16762143650: 2.4%
Covered Lines: 1380
Relevant Lines: 2395

💛 - Coveralls

TRK95 and others added 17 commits August 11, 2025 03:56
…STORE_ENV instruction to properly restore environment after function calls - Fix function parameter binding in CSE machine - Compound functions now work correctly (functions using other functions) - Linear recursion and iteration working properly
…o handle (list) as function call instead of list literal - Fix car/cdr to work with both lists and pairs - Fix pair? to recognize lists as pairs - Fix list? to recognize empty list () as list - Add length function for lists and pairs - Fix quote syntax to parse 'a 'b 'c as symbols
…ct formatting standards - Fix CI pipeline formatting check
Bumps [jest](https://github.com/jestjs/jest/tree/HEAD/packages/jest) from 30.0.4 to 30.0.5.
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v30.0.5/packages/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-version: 30.0.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 29.4.0 to 29.4.1.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](kulshekhar/ts-jest@v29.4.0...v29.4.1)

---
updated-dependencies:
- dependency-name: ts-jest
  dependency-version: 29.4.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Add complete CSE machine implementation with SICP Chapter 1 support
- Add Source Academy Conductor integration following py-slang pattern
- Add complex numbers support (exceeds py-slang capabilities)
- Add comprehensive test suite with 100% pass rate
- Add UMD bundle build system for production deployment
- Preserve original transpiler system unchanged
TRK95 added 11 commits September 8, 2025 14:59
…STORE_ENV instruction to properly restore environment after function calls - Fix function parameter binding in CSE machine - Compound functions now work correctly (functions using other functions) - Linear recursion and iteration working properly
…o handle (list) as function call instead of list literal - Fix car/cdr to work with both lists and pairs - Fix pair? to recognize lists as pairs - Fix list? to recognize empty list () as list - Add length function for lists and pairs - Fix quote syntax to parse 'a 'b 'c as symbols
…ct formatting standards - Fix CI pipeline formatting check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants