
import STDLIB/default-instruction-set.lm;
import STDLIB/default-primitives.lm;
import STDLIB/default-stdlib.lm;
import STDLIB/default-rules.lm;

type ParsePartial (PME( U64 , U64 )); # term, remainder

close := λ(: x ParsePartial). (: (tail(
   (mov( (malloc(sizeof ParsePartial)) R8 ))
   (mov( x 0_u64 (as R8 ParsePartial[]) ))
   (as R8 ParsePartial[])
)) ParsePartial[]);

part := λ. (: (tail(
   ()
   (close (PME( 1_u64 2_u64 )))
)) ParsePartial[]);

main := (
   (match (part()) (
      ()
      ( (PME( l r )) (print r) )
   ))
);
