MLPolyR icon indicating copy to clipboard operation
MLPolyR copied to clipboard

Porting to PolyML

Open LdBeth opened this issue 5 years ago • 16 comments

See https://github.com/owo-lang/MLPolyR/commit/36d8c331659665c02c426e7968800ba80a42e811

Most part of smlnj-lib can run on polyml after minor patches, porting to poly has following benefits:

  • standalone executable #2
  • 64 bit support
  • clean up code
  • better debugger
  • I can compile poly on my Mac but it does not apply to smlnj

LdBeth avatar May 08 '19 00:05 LdBeth

How can I build MLPolyR with PolyML ATM?

ice1000 avatar May 08 '19 01:05 ice1000

it is not ready yet, I'm checking the non standard derivations in source and once all the files are listed in https://github.com/owo-lang/MLPolyR/blob/polyml/load.sml it should be ready to build and I'll update Makefile

LdBeth avatar May 08 '19 03:05 LdBeth

Now you can run make check which only use compiler to check programs and produce no executable.

LdBeth avatar May 08 '19 04:05 LdBeth

LdBeth good good

anqurvanillapy avatar May 09 '19 01:05 anqurvanillapy

Now both ml-lex ml-yacc are ported to polyml and can be compiled to stand alone complex and can be used to generate grammar. https://github.com/owo-lang/MLPolyR/commit/e601f7f86bae94501c2396687b02e3885191fcdc

Shall we create new repo and submodule them?

LdBeth avatar May 09 '19 04:05 LdBeth

Can't we just provide several Makefiles that uses different toolchains?

ice1000 avatar May 09 '19 04:05 ice1000

That’s tedious. I’d use autotools or something. Building systems aren’t compatible across sml implementations, and some enforce special source code layout, ie file and directory name must match module layout, can not get it work out of box.

LdBeth avatar May 09 '19 18:05 LdBeth

Oh my god. How about keep several branches?

ice1000 avatar May 09 '19 19:05 ice1000

How can I build a compiler exe? Currently check only prints 13..

ice1000 avatar May 10 '19 01:05 ice1000

syntax tree representation uses SML/NJ compiler components, I haven’t figured if there’s proper replacement yet

LdBeth avatar May 10 '19 04:05 LdBeth

Can we add SML/NJ compiler itself as a dependency?

ice1000 avatar May 10 '19 04:05 ice1000

If so, we can completely remove SML/NJ backend and use PolyML only. Thus no branches needed.

Edit: s/MLton/PolyML/rg

ice1000 avatar May 10 '19 04:05 ice1000

Ok, I'll drop support for SML/NJ and rewrite using similar but simpler components from Tiger

LdBeth avatar May 15 '19 08:05 LdBeth

https://github.com/owo-lang/MLPolyR/commit/8b63bee55a5b1a27f0547a255dccdd4cecf2c7d1

Now make check would produce an executable check and it can be used to syntax check & type check MLPolyR programs. Exit with 0 means it is ok otherwise means not ok. Notice that sometimes it says nothing when failed. To get the exit status of last command, in bash or ksh you can type

echo $?

for last command exit status.

螢幕快照 2019-05-17 下午12 30 12 螢幕快照 2019-05-17 下午12 29 21

I'm still working on figure out how to properly report parse/type errors since the original error report facility heavily relies on SML/NJ's compiler component and at current Poly/ML port these facilities are basically placeholders.

LdBeth avatar May 17 '19 04:05 LdBeth

tql

ice1000 avatar May 17 '19 05:05 ice1000

such a breakthru

anqurvanillapy avatar May 17 '19 07:05 anqurvanillapy