Compiler and PHP questions

Joe Armstrong (AL/EAB) <>
Tue Nov 29 11:36:00 CET 2005


1) Does anybody have or is anybody working on a parser for php written in erlang - please contact me
   if this is the case.

2) Is there an easy way to get line numbers right in transformed code?

   Suppose I have an input file foo.ehe with some embedded code:

	...
	<h1>title</h1>
	<p>hello <? getDb "name") ?> how are you

   Into foo.erl 

	foo(A) ->
	    output(<<"<h1>title</h1>\n<p>hellon "),
	    getDb "name"),
	    output(<<" how are you">>).

    And run this through the compiler then the line number with the error
refers to foo.erl and NOT foo.ehe.

    I thought there was an annotation you could add to the source. Like this:

	-file("foo.ehe", 23)
	foo(A) ->
	   ...

     To tell the compiler that foo(A) came from foo.ehe line 23.

     This seems to be broken (there *is* code in epp.erl to do this and I *can* change the
file name but *not* the line number). Is this a bug or a feature or have I misunderstood
something?

     The alternative seems to be to run a parse transform on an empty file and
transform the empty file into a parse tree with the correct line numbers in it.

/Joe


	    

    



More information about the erlang-questions mailing list