mosh icon indicating copy to clipboard operation
mosh copied to clipboard

Stop using Gauche in the bootstrap process

Open higepon opened this issue 2 years ago • 10 comments

higepon avatar Sep 09 '22 10:09 higepon

It seems porting vm.scm to Mosh is not trivial. I think it would be a few hours of work If everything goes well.

higepon avatar Sep 09 '22 12:09 higepon

Reduced 1 gosh dependency.

higepon avatar Sep 10 '22 14:09 higepon

Notes for myself. I was not able to make vm.scm work with Mosh. Still need more work higepon/mosh at gosh_vm2.

higepon avatar Sep 11 '22 22:09 higepon

What to do

Use mosh instead of gosh in /root/mosh.git/boot/Makefile.

psyntax-mosh-image.scmc: runtimes/psyntax-mosh/psyntax.scm compiler-vm.scm
	gosh vm.scm compile-file-without-macro $< > $@
	sed -i -e "s/#\\\\null/#\\\\nul/g;s/|\.\.\.|/\.\.\./g" $@

match.scmc: baselib/match.scm compiler-vm.scm
	gosh vm.scm compile-file-without-macro $< > $@
	sed -i -e "s/#\\\\null/#\\\\nul/g;s/|\.\.\.|/\.\.\./g" $@

baselib.scmc: baselib.scm compiler-vm.scm
	gosh vm.scm compile-file-with-macro $< > $@
	sed -i -e "s/#\\

Notes

  • nmosh using vm.scm in mosh.git/misc/scripts/gen-nmosh-bootstrap.sps. It converts vm.scm => vm.sls. Is this being used? cc @okuoku
  • vm.scm written in Gauche Scheme. R5RS style.
    • vm.scm is using define-syntax heavily.
  • load the following libraries
    • ./baselib/match.scm
      • I don't see any issue.
    • ./free-vars-decl.scm
      • I don't see any issue
    • ./compiler-vm.scm
      • This is generated by gen-compiler as follows. It expands cond-expand in compiler.scm.
      • compiler.scm is using define-macro very heavily.
compiler-vm-cpp.scm: compiler.scm free-vars-decl.scm $(CORE_INCLUDE_LIBS)
	mosh -5 $(SCRIPTS_DIR)/gen-compiler.scm $< "mosh" > $@

compiler-vm.scm: compiler.scm free-vars-decl.scm $(CORE_INCLUDE_LIBS)
	mosh -5 $(SCRIPTS_DIR)/gen-compiler.scm $< "vm?" > $@
  • mosh should run vm.scm as r6rs script.

Command to run the script

(cd boot/ && rm baselib.scmc && make baselib.scmc)

higepon avatar Sep 12 '22 08:09 higepon

This is difficult one!

# (cd boot/ && rm baselib.scmc && make baselib.scmc)
mosh vm.scm compile-file-with-macro baselib.scm > baselib.scmc
 Condition components:
 1. &message       message: "invalid expression"
 2. &syntax        form: ()
                   subform: #f

higepon avatar Sep 12 '22 10:09 higepon

Is this being used?

No. That was failed attempt to port vm to R6RS. I guess we can drop gen-nmosh-bootstrap.sps entirely.

okuoku avatar Sep 12 '22 11:09 okuoku

Is this being used?

No. That was failed attempt to port vm to R6RS. I guess we can drop gen-nmosh-bootstrap.sps entirely.

Okay! will do.

higepon avatar Sep 12 '22 12:09 higepon

This is difficult one!

This should really tell the line number of the location. Will look into it.

higepon avatar Sep 12 '22 12:09 higepon

@higepon prioritize this so that mosh can be distributed via homebrew.

higepon avatar Oct 01 '22 15:10 higepon

Tried. But this is so hard.

higepon avatar Oct 02 '22 02:10 higepon