Giter Site home page Giter Site logo

Comments (1)

SeungUkLee avatar SeungUkLee commented on May 23, 2024

M Spec에 Static Semantics 의 $\text{[Op]}$, $\text{[Write]}$ rule 을 보면 $\tau$ 가 각각 $i, b, s, l$$i, b, s$ 인 것을 볼 수 있다.

즉, m_algorithm 에 pattern matching 에서 다음과 같이 TVar로 타입변수를 만들면 안됨.

let rec m_algorithm : TyEnv.t -> M.exp -> typ -> Subst.t =
 fun tyenv exp expected ->
  match exp with
  | ...
  | M.WRITE e -> 
    let a = TVar (new_var ()) in ...
  | M.BOP (op, e1, e2) ->
    let bop op r = ...
    match op with
    | ...
    | M.EQ -> bop (TVar (new_var ())) TBool)
  | ...

이는 다음과 같이 TWritableVar, TComparableVar 을 추가하면 간단하게 해결이 가능하다: b63d2bc 참고

type typ =
  | ...
  | TVar of var
  | TWritableVar of var
  | TComparableVar of var

...

let rec m_algorithm : TyEnv.t -> M.exp -> typ -> Subst.t =
 fun tyenv exp expected ->
  match exp with
  | ...
  | M.WRITE e -> 
    let a = TWritableVar (new_var ()) in ...
  | M.BOP (op, e1, e2) ->
    let bop op r = ...
    match op with
    | ...
    | M.EQ -> bop (TComparableVar (new_var ())) TBool)
  | ...

하지만,

  • #2 또 다른 문제가 발생

from learning-snupl.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.