move everything

This commit is contained in:
Joeri Exelmans 2025-05-23 22:35:47 +02:00
parent 3ff7e76694
commit 9050581a10
25 changed files with 37 additions and 42 deletions

View file

@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import './App.css'; import './App.css';
import { ExprBlock, type ExprBlockState } from './ExprBlock'; import { ExprBlock, type ExprBlockState } from '../expr/ExprBlock';
import { GlobalContext } from './GlobalContext'; import { GlobalContext } from '../../context/GlobalContext';
import { biggerExample, emptySet, factorial, higherOrder, higherOrder2Params, inc, initialEditorState, lambda2Params, nonEmptyEditorState, pushBool, tripleFunctionCallEditorState } from "./configurations"; import { biggerExample, emptySet, factorial, higherOrder, higherOrder2Params, inc, initialEditorState, lambda2Params, nonEmptyEditorState, pushBool, tripleFunctionCallEditorState } from "./configurations";
import { actionShortcuts } from './actions'; import { actionShortcuts } from './actions';
// import { scoreResolved, type ResolvedType } from './eval'; // import { scoreResolved, type ResolvedType } from './eval';

View file

@ -1,4 +1,4 @@
import type { ExprBlockState } from "./ExprBlock"; import type { ExprBlockState } from "../expr/ExprBlock";
export const initialEditorState: ExprBlockState = { export const initialEditorState: ExprBlockState = {
kind: "input", kind: "input",

View file

@ -1,16 +1,15 @@
import { useContext } from "react"; import { useContext } from "react";
import { EnvContext } from "./EnvContext"; import { EnvContext } from "../../context/EnvContext";
// import { addFocusRightMost, evalCallBlock2, evalExprBlock, recomputeTypeVarsForEnv, scoreResolved, type Environment, type ResolvedType } from "./eval"; // import { addFocusRightMost, evalCallBlock2, evalExprBlock, recomputeTypeVarsForEnv, scoreResolved, type Environment, type ResolvedType } from "./eval";
import { ExprBlock, type ExprBlockState, type SetStateFn, type State2Props } from "./ExprBlock"; import { ExprBlock, type ExprBlockState, type SetStateFn, type State2Props } from "./ExprBlock";
import { GlobalContext } from "./GlobalContext"; import { GlobalContext } from "../../context/GlobalContext";
import { Value } from "./Value";
import { getActions } from "./actions"; import { getActions } from "../app/actions";
import "./CallBlock.css"; import "./CallBlock.css";
import { CallContext } from "./CallContext"; import { CallContext } from "../../context/CallContext";
import { inferType, inferTypeCall, type Environment } from "./infer_type"; import { inferTypeCall, type Environment } from "../../eval/infer_type";
import { Type } from "./Type"; import { Type } from "../other/Type";
export interface CallBlockState { export interface CallBlockState {
kind: "call"; kind: "call";

View file

@ -3,18 +3,16 @@ import { useContext } from "react";
import { getType } from "dope2"; import { getType } from "dope2";
import { CallBlock, type CallBlockProps, type CallBlockState } from "./CallBlock"; import { CallBlock, type CallBlockProps, type CallBlockState } from "./CallBlock";
import { EnvContext } from "./EnvContext"; import { EnvContext } from "../../context/EnvContext";
import { GlobalContext } from "./GlobalContext"; import { GlobalContext } from "../../context/GlobalContext";
import { InputBlock, type InputBlockProps, type InputBlockState } from "./InputBlock"; import { InputBlock, type InputBlockProps, type InputBlockState } from "./InputBlock";
import { LambdaBlock, type LambdaBlockProps, type LambdaBlockState } from "./LambdaBlock"; import { LambdaBlock, type LambdaBlockProps, type LambdaBlockState } from "./LambdaBlock";
import { LetInBlock, type LetInBlockProps, type LetInBlockState } from "./LetInBlock"; import { LetInBlock, type LetInBlockProps, type LetInBlockState } from "./LetInBlock";
import { Type } from "./Type";
// import { evalExprBlock, type ResolvedType } from "./eval"; // import { evalExprBlock, type ResolvedType } from "./eval";
import "./ExprBlock.css"; import "./ExprBlock.css";
import { Input } from "./Input"; import { Input } from "../other/Input";
import { getActions } from "./actions"; import { getActions } from "../app/actions";
import { inferType } from "./infer_type";
export type ExprBlockState = export type ExprBlockState =
InputBlockState InputBlockState

View file

@ -1,18 +1,18 @@
import { memo, useContext, useEffect, useMemo, useRef, useState } from "react"; import { memo, useContext, useEffect, useMemo, useRef, useState } from "react";
import { getType, prettyT, trie } from "dope2"; import { trie } from "dope2";
import { EnvContext } from "./EnvContext"; import { EnvContext } from "../../context/EnvContext";
// import type { Environment, ResolvedType } from "./eval"; // import type { Environment, ResolvedType } from "./eval";
import "./InputBlock.css"; import "./InputBlock.css";
import { Type } from "./Type"; import { Type } from "../other/Type";
import type { ExprBlockState, State2Props } from "./ExprBlock"; import type { ExprBlockState, State2Props } from "./ExprBlock";
// import { attemptParseLiteral } from "./eval"; // import { attemptParseLiteral } from "./eval";
import { Input } from "./Input"; import { Input } from "../other/Input";
import { CallContext } from "./CallContext"; import { CallContext } from "../../context/CallContext";
import { getActions } from "./actions"; import { getActions } from "../app/actions";
import { GlobalContext } from "./GlobalContext"; import { GlobalContext } from "../../context/GlobalContext";
import { inferTypeInput } from "./infer_type"; import { inferTypeInput } from "../../eval/infer_type";
interface Literal { interface Literal {
kind: "literal"; kind: "literal";

View file

@ -3,13 +3,13 @@ import { useContext } from "react";
// import { eqType, getSymbol, reduceUnification } from "dope2"; // import { eqType, getSymbol, reduceUnification } from "dope2";
import { ExprBlock, type ExprBlockState, type State2Props } from "./ExprBlock"; import { ExprBlock, type ExprBlockState, type State2Props } from "./ExprBlock";
import { EnvContext } from "./EnvContext"; import { EnvContext } from "../../context/EnvContext";
// import { evalExprBlock, evalLambdaBlock, makeInnerEnv, makeTypeVar } from "./eval"; // import { evalExprBlock, evalLambdaBlock, makeInnerEnv, makeTypeVar } from "./eval";
import "./LambdaBlock.css"; import "./LambdaBlock.css";
import { Type } from "./Type"; import { Type } from "../other/Type";
import { Input } from "./Input"; import { Input } from "../other/Input";
import { inferTypeLambda } from "./infer_type"; import { inferTypeLambda } from "../../eval/infer_type";
export interface LambdaBlockState { export interface LambdaBlockState {
kind: "lambda"; kind: "lambda";

View file

@ -1,15 +1,15 @@
import { useContext } from "react"; import { useContext } from "react";
import { ExprBlock, type ExprBlockState } from "./ExprBlock"; import { ExprBlock, type ExprBlockState } from "./ExprBlock";
import { EnvContext } from "./EnvContext"; import { EnvContext } from "../../context/EnvContext";
// import { evalExprBlock, makeInnerEnv, scoreResolved, type ResolvedType } from "./eval"; // import { evalExprBlock, makeInnerEnv, scoreResolved, type ResolvedType } from "./eval";
import { type State2Props } from "./ExprBlock"; import { type State2Props } from "./ExprBlock";
import { GlobalContext } from "./GlobalContext"; import { GlobalContext } from "../../context/GlobalContext";
import "./LetInBlock.css"; import "./LetInBlock.css";
import { Input } from "./Input"; import { Input } from "../other/Input";
import { inferTypeLet } from "./infer_type"; import { inferTypeLet } from "../../eval/infer_type";
import { Type } from "./Type"; import { Type } from "../other/Type";
export interface LetInBlockState { export interface LetInBlockState {
kind: "let"; kind: "let";

View file

@ -1,10 +1,10 @@
import { Double, eqType, fnType, IncompatibleTypesError, Int, mergeSubstitutionsN, occurring, prettySS, recomputeTypeVars, substitute, trie, TYPE_VARS, UNBOUND_SYMBOLS, unify } from "dope2"; import { Double, eqType, fnType, IncompatibleTypesError, Int, mergeSubstitutionsN, occurring, prettySS, recomputeTypeVars, substitute, trie, TYPE_VARS, UNBOUND_SYMBOLS, unify } from "dope2";
import type { CallBlockState } from "./CallBlock"; import type { CallBlockState } from "../component/expr/CallBlock";
import type { ExprBlockState } from "./ExprBlock"; import type { ExprBlockState } from "../component/expr/ExprBlock";
import type { InputBlockState } from "./InputBlock"; import type { InputBlockState } from "../component/expr/InputBlock";
import type { LambdaBlockState } from "./LambdaBlock"; import type { LambdaBlockState } from "../component/expr/LambdaBlock";
import type { LetInBlockState } from "./LetInBlock"; import type { LetInBlockState } from "../component/expr/LetInBlock";
export interface Environment { export interface Environment {
names: any; names: any;
@ -93,7 +93,7 @@ export function inferTypeCall(s: CallBlockState, env: Environment): TypeInfoCall
const subs = unify( const subs = unify(
fnTypeInfo.type, fnTypeInfo.type,
fakeFnType); fakeFnType);
console.log("subs:", prettySS(subs)); // console.log("subs:", prettySS(subs));
let type, newEnv; let type, newEnv;
if (subs.has(returnType!.symbol)) { if (subs.has(returnType!.symbol)) {
type = subs.get(returnType!.symbol); type = subs.get(returnType!.symbol);
@ -136,8 +136,6 @@ export function inferTypeLet(s: LetInBlockState, env: Environment): TypeInfoLamb
names: trie.insert(env.names)(s.name)({kind: "value", t: valTypeInfo.type}), names: trie.insert(env.names)(s.name)({kind: "value", t: valTypeInfo.type}),
typevars: env.typevars, typevars: env.typevars,
}; };
console.log(s.name);
console.log("innerEnv.names:", innerEnv.names);
return { return {
...inferType(s.inner, innerEnv), ...inferType(s.inner, innerEnv),
paramType: valTypeInfo.type, paramType: valTypeInfo.type,

View file

@ -1,6 +1,6 @@
import { StrictMode } from 'react' import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client' import { createRoot } from 'react-dom/client'
import { App } from './App.tsx' import { App } from './component/app/App.tsx'
import './index.css' import './index.css'
import '@fontsource-variable/inconsolata/standard.css'; import '@fontsource-variable/inconsolata/standard.css';