我将一个 OCaml 项目移植到 ReasonML,但首先移植到 BuckleScript。我在项目目录中播种
bsb init .
并复制 *.ml 文件。编译
npm run build
给我错误:
[1/6] 搭建src/demo.cmj 文件“/d/ProgLang/reason/src/demo.ml”,第 2 行,字符 7-17:错误:未绑定值 Str.regexp [2/6] 构建 src/lex.cmj 文件“/d/ProgLang/reason/src/lex.ml”,第 13 行,字符 26-44:错误:未绑定值 Str.search_forward
我的 package.json 有
"devDependencies": {
"bsb-native": "^4.0.7000"
}
和 ./node_modules/bsb-native/vendor/ocaml/lib/ocaml包含文件str.a str.cma str.cmi str.cmx str.cmxs str.mli,但没有像 str.ml 这样的源。此外,https://reasonml.github.io/api/Str.html记录了我需要的功能,但是在定位 Javascript(节点)时如何链接它们?
我可以同时使用 Javascript 或本机目标,但我想从 OCaml 语法升级到 ReasonML。如果你需要我的 demo.ml,这里是:
let qq=Str.regexp "/q/" and
() = Js.log "Hello, STR! BuckleScript"