Quantcast
Viewing latest article 34
Browse Latest Browse All 1691

ReMonkey: An implementation of the Monkey Langauge written in ReScript

Cool!

Did you try using the char datatype for it before? It’s at least very convenient if ASCII is sufficient to your needs, since you can check ranges, e.g.:

let isLetter = char =>
  switch char {
  | 'a' .. 'z' | 'A' .. 'Z' | '_' => true
  | _ => false
  }

let isDigit = char =>
  switch char {
  | '0' .. '9' => true
  | _ => false
  }

let isWhitespace = char =>
  switch char {
  | ' ' | '\t' | '\n' | '\r' => true
  | _ => false
  }

But it’s a bit quirky to use since it was inherited from the OCaml standard library, which is why we want to change it a bit (see RFC: RFC: Revise `char` primitive · Issue #7028 · rescript-lang/rescript · GitHub)

I am impressed that you tried to implement it in a whole bunch of languages, I guess you want to compare the strengths and weaknesses of all of them in that blog post.

I am looking forward to it!


Viewing latest article 34
Browse Latest Browse All 1691

Trending Articles