Abstract forms

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Abstract forms

Vlad Dumitrescu-3
> > I have been playing a lot with code, erl_parse, beam_lib and the
> > likes, and things go pretty well.

>It could be fed into compile:forms, but you'd have to modify it a bit
>first:
> - add a module declaration form at the top of the list:
>    {attribute,Line,module,ModuleName}
> - remove the auto-generated code for "module_info" functions:
>    {function,Line,module_info,0,Clauses}
>    {function,Line,module_info,1,Clauses}

Thanks. I had managed to work it out myself, and it works now.

However, there is a problem: if I try to compile a function with guards, I
get an error from the compiler saying "illegal guard expression". It works
fine to compile it as usual... Any idea why?

Then there is a more general observation: it's not at all easy to navigate
the abstract forms in order to make changes... compared to Lisp, anyway,
because there everything is a list, here the structure is heterogenous...

regards,
Vlad
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.



Reply | Threaded
Open this post in threaded view
|

Abstract forms

Richard Carlsson-4

On Tue, 16 Jan 2001, Vlad Dumitrescu wrote:

> However, there is a problem: if I try to compile a function with guards, I
> get an error from the compiler saying "illegal guard expression". It works
> fine to compile it as usual... Any idea why?

Not sure. Do you mean guards that you have constructed yourself, or guards
as found in the beam file?

> Then there is a more general observation: it's not at all easy to
> navigate the abstract forms in order to make changes... compared to
> Lisp, anyway, because there everything is a list, here the structure
> is heterogenous...

Yes, that's a big bother. You could look at my syntax_tools package under
http://www.erlang.org/user.html - it makes the "abstract form" look like a
homogeneous syntax tree structure.

        /Richard

Richard Carlsson (richardc)   (This space intentionally left blank.)
E-mail: Richard.Carlsson WWW: http://www.csd.uu.se/~richardc/