anchor.diff:       binary,                                    %We want a binary
        no_bopt|Os1].
   
  +%% split_pp(State) -> {ok,State} | {error,State}.
  +%% umac_pp(State) -> {ok,State} | {error,State}.
   %% expand_pp(State) -> {ok,State} | {error,State}.
  -%% group_pp(State) -> {ok,State} | {error,State}.
  -%% umac_pp(State) -> {ok,State} | {error,State}.
   %% pmod_pp(State) -> {ok,State} | {error,State}.
   %% lint_pp(State) -> {ok,State} | {error,State}.
   %% sexpr_pp(State) -> {ok,State} | {error,State}.
  
positive.code: -module(lfe_comp).
  
  -export([file/1,file/2,forms/1,forms/2,default_options/0]).
  
  -export([group_modules/1]).
  
  %% -compile(export_all).
  
  
negative.code:                            warnings=St#comp.warnings ++ Ws}}
      end.
  
  %% collect_forms(Forms, State) ->
  %%     {PreForms,RestForms,Env,State}.
  
  collect_forms(Fs, Ci) ->
      St0 = lfe_macro:macro_form_init(Ci),
      Env0 = lfe_env:new(),
      collect_mod_forms(Fs, Env0, St0).
  
  %% collect_modules(Forms, PreForms, PreEnv, State) ->
  %%     {Modules,State}.
  %%  Collect and expand modules upto the end. Each module initially has
  %%  the pre environment and all pre forms are appended to it.
  
  collect_modules(Fs, PreFs, PreEnv, St) ->
      collect_modules(Fs, [], PreFs, PreEnv, St).
  
  collect_modules([{['define-module',Name|_],_}=Mdef|Fs0], Ms, PreFs, PreEnv, St0) ->
      %% Expand and collect all forms upto next define-module or end.
      {Mfs0,Fs1,_,St1} = collect_mod_forms(Fs0, PreEnv, St0),
      M = {ok,Name,[Mdef] ++ PreFs ++ Mfs0,[]},
      collect_modules(Fs1, [M|Ms], PreFs, PreEnv, St1);
  collect_modules([], Ms, _PreFs, _PreEnv, St) ->
      {lists:reverse(Ms),St}.
  
  %% collect_mod_forms(Forms, Env, State) ->
  %% collect_mod_forms(Forms, Acc, Env, State) ->
  %%     {Modforms,RestForms,Env,State}.
  %%  Expand and collect forms upto the next define-module or end. We
  %%  also flatten top-level nested progn code.
  
  collect_mod_forms(Fs, Env0, St0) ->
      {Acc,Rest,Env1,St1} = collect_mod_forms(Fs, [], Env0, St0),
      {lists:reverse(Acc),Rest,Env1,St1}.
  
  collect_mod_forms([F0|Fs0], Acc, Env0, St0) ->
      case lfe_macro:macro_fileform(F0, Env0, St0) of
  	{{['define-module'|_],_}=F1,Env1,St1} ->
  	    {Acc,[F1|Fs0],Env1,St1};
  	{{['progn'|Pfs],L},Env1,St1} ->		%Flatten progn's
  	    Fs1 = [ {F,L} || F <- Pfs ] ++ Fs0,
  	    collect_mod_forms(Fs1, Acc, Env1, St1);
  	{F1,Env1,St1} ->
  	    collect_mod_forms(Fs0, [F1|Acc], Env1, St1)
      end;
  collect_mod_forms([], Acc, Env, St) -> {Acc,[],Env,St}.
  
  %% do_user_macros(State) -> {ok,State} | {error,State}.
  %% do_expand_macros(State) -> {ok,State} | {error,State}.
  %%  Process the macros in each module. Do_expand_macros is the last
  %%  pass which fully expands all remaining macros and flattens the
  %%  output.
  
  do_user_macros(#comp{cinfo=Ci,code=Ms0}=St) ->
      Umac = fun ({ok,Name,Mfs0,Ws}) ->
                     {Mfs1,_} = lfe_user_macros:module(Mfs0, Ci),
                     {ok,Name,Mfs1,Ws}
             end,
      Ms1 = lists:map(Umac, Ms0),
      {ok,St#comp{code=Ms1}}.
  
  do_expand_macros(#comp{cinfo=Ci,code=Ms0}=St) ->
      Emac = fun ({ok,Name,Fs0,Ws}) ->
  		   Env0 = lfe_env:new(),
  		   St0 = lfe_macro:expand_form_init(Ci),
  		   {Fs1,_} = lfe_lib:proc_forms(fun expand_form/3,
  						Fs0, {Env0,St0}),
  		   {ok,Name,Fs1,Ws}
  	   end,
      Ms1 = lists:map(Emac, Ms0),
      {ok,St#comp{code=Ms1}}.
  
  expand_form(F0, L, {Env0,St0}) ->
      case lfe_macro:expand_form(F0, L, Env0, St0) of
  	{[progn|Pfs],Env1,St1} ->
  	    lfe_lib:proc_forms(fun expand_form/3, Pfs, L, {Env1,St1});
  	{['eval-when-compile'|_],Env1,St1} ->
  	    {[],{Env1,St1}};
  	{F1,Env1,St1} ->
  	    {[{F1,L}],{Env1,St1}}
      end.
  
  %% do_lfe_pmod(State) -> {ok,State} | {error,State}.
  %% do_lint(State) -> {ok,State} | {error,State}.
  %% do_lfe_codegen(State) -> {ok,State} | {error,State}.
  %% do_erl_comp(State) -> {ok,State} | {error,State}.
  %%  The actual compiler passes.
  
  do_lfe_pmod(#comp{cinfo=Ci,code=Ms0}=St) ->
      Pmod = fun ({ok,_,Mfs0,Ws}) ->
  