Skip to content

Logic engine#1030

Merged
ARtheboss merged 42 commits intomainfrom
logic-engine
Mar 31, 2026
Merged

Logic engine#1030
ARtheboss merged 42 commits intomainfrom
logic-engine

Conversation

@ARtheboss
Copy link
Copy Markdown
Contributor

@ARtheboss ARtheboss commented Dec 30, 2025

Summary

This PR introduces BtLL (Berkeleytime Logical Language), a custom interpreted programming language for expressing and evaluating academic requirements in GradTrak. It includes:

  • A complete interpreter for the BtLL language with type safety and custom functions
  • Database models for storing requirement definitions (PlanRequirement) and user progress (SelectedPlanRequirement)
  • GraphQL API endpoints for fetching requirements by college, major, and minor
  • A new React UI component for displaying requirement evaluation results with manual override support
  • Reference requirement definitions for UC, College of Engineering, College of CDSS, and several majors (EECS, Computer Science, Data Science, Mechanical Engineering)

Did we need a new programming language for this? Probably not. But it was fun to make it, and is probably much safer than executing actual code.

Key Changes

BtLL Interpreter (packages/BtLL/)

  • Full interpreter with support for functions, lists, objects, and control flow
  • Built-in types: Plan, Course, Column, Requirement, and 6 extended requirement types
  • Specialized requirement types for academic use cases:
    • BooleanRequirement - simple pass/fail
    • NCoursesRequirement - N courses from a list
    • CourseListRequirement - specific required courses
    • AndRequirement / OrRequirement - composite requirements
    • NumberRequirement - numeric thresholds (e.g., unit counts)

Backend

  • New MongoDB schemas: PlanRequirement and SelectedPlanRequirement
  • GraphQL queries: ucRequirements, collegeRequirements, planRequirementsByMajorsAndMinors
  • GraphQL mutations: updateManualOverride, updateSelectedPlanRequirements

Frontend

  • New BtLLInterface component that fetches requirements from DB and evaluates them against user's plan
  • Collapsible requirement sections with checkmark indicators
  • Manual override support (green = auto-satisfied, white = manually toggled)
  • "Coming Soon" placeholders for majors/minors without defined requirements

Tooling

  • generate-mongosh-commands.ts script for seeding requirement data
  • npm scripts: npm run generate:mongosh and npm run seed:requirements

Test plan

  • Verify BtLL interpreter tests pass: cd packages/BtLL && npm test
  • Seed requirements to local MongoDB: cd packages/BtLL && npm run seed:requirements
  • Create a new plan with EECS/MechE major in College of Engineering (or DS/CS major in CDSS)
  • Verify UC, College, and Major requirements load and display correctly
  • Add courses to plan and verify requirement checkmarks update
  • Test manual override toggle on individual requirements
  • Verify "Coming Soon" displays for unsupported majors/minors

Next Steps

  • Simplify Semester Blocks: Only display SemesterBlocks that contribute to overall counts (one per semester + transfer units). Add a separate "scratch space" with a distinct visual style for staging classes before placing them in semesters. This makes drag-and-drop between the scratch space and semesters more intuitive.

  • Catalog Scraper: Create scripts to web scrape the Berkeley catalog and parse requirements into BtLL, likely using an LLM to interpret natural language requirements.

  • User-Created Requirements: Allow users to edit and create their own BtLL requirement files for custom degree audits or unofficial majors/minors.

  • BtLL Editor Interface: Build a visual interface for editing BtLL code more easily, lowering the barrier for non-technical users.

  • Prerequisite Requirements: Extend BtLL usage beyond degree requirements to express course prerequisites, enabling prerequisite validation in the scheduler.

@ARtheboss ARtheboss marked this pull request as ready for review January 15, 2026 08:09
@ARtheboss ARtheboss merged commit 2d08ec8 into main Mar 31, 2026
5 checks passed
@ARtheboss ARtheboss deleted the logic-engine branch March 31, 2026 08:51
ARtheboss added a commit that referenced this pull request Apr 1, 2026
ARtheboss added a commit that referenced this pull request Apr 1, 2026
ARtheboss added a commit that referenced this pull request Apr 1, 2026
* Revert "Revert "Logic engine (#1030)""

This reverts commit fa48909.

* lint
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.

3 participants