I lied a bit - I have pushed the code already.
Not exactly a thing of beauty, but we are getting there.
Happy to hear other views on priorities.
> SUCCESS!
> Well, . . . kinda.
> I have got through to the end of all the files, but i had a couple of
> stumbles that I had to work around:
> 1) src/builtins/exceptions.re
> has a spelling error on line 43 (Excpetions)
> 2) test/core/operator_test.re
> on line 80 tests for equality of (42, ~-43). For the -43 the leex/yecc
> parser constructs a unary minus operator with operand {integer,x,43}. In the
> PEG grammar I have made a slight simplification by making the integer's
> value signed (i.e. constructing {integer,x,-43)) whenever the sign is
> adjacent to the digits. In other words, a leading sign on a float or integer
> is considered to be part of the number. (I do not expect that this will
> break any existing code.) To avoid the discrepancy in the parse trees I
> changed the test to compare (-44, ~43).
> 3) test/builtins/atom_test.re
> seemed not to parse properly under either parser. Had to comment out
> lines 14-25
> 4) class/test/core/class_test.re
> also did not parse properly. Commented out lines 9-18.
> These last two are a little puzzling so I would be interested to know if
> they are valid code.
> Anyway, too late for further thoughts on this. I will tidy things up a bit
> and push all this tomorrow.
> g
> ____________________________________________
> On 3 February 2011 18:22, Tony Arcieri <tony.arci...@medioh.com> wrote:
>> Great news! I was actually just poking around at it myself and made this:
>> https://gist.github.com/809362
>> That's the output from your parser and subsequently the Reia compiler.
>> I committed a change which disables the caching of compiled Reia bytecode,
>> since the first thing I encountered when I tried to run the tests was all of
>> them passing as the only file it compiled was test/runner.re (which
>> seemed to work?)
>> I was just about to commit some debugging that would print out the output
>> of the entire Reia compiler which it then passes to the Erlang compiler.
>> On Thu, Feb 3, 2011 at 12:13 PM, Graeme Defty <graeme.de...@gmail.com>wrote:
>>> Sorted! I have built a small test rig that trawls through the directory
>>> structure looking for '.re' files, passes them to both parsers and compares
>>> the output.
>>> The comparison was non-trivial because the old parser puts incorrect line
>>> numbers in some places, and so the comparison had to walk the parse tree in
>>> a (semi-) intelligent manner. Neverthess, I am glad I have this, because it
>>> has highlighted a couple of oddities (with more to come no doubt) and at the
>>> end of this exercise, I will be very confident that we are generating the
>>> right tree. Not sure yet if I have come to the file that generates the error
>>> below.
>>> I will push it as part of the project once it has found all the errors it
>>> can.
>>> At some point we will not be able to compare with the old parser, but I
>>> am also adding unit tests to the parser tester to cover the odd cases that I
>>> uncover (and that I failed to consider initially)
>>> As a side note - one bizarre aspect of all this is that I have yet to
>>> write a single line of Reia code myself!
>>> _________________________________________________
>>> On 2 February 2011 15:45, Tony Arcieri <tony.arci...@medioh.com> wrote:
>>>> I'm visiting Switzerland now for business, but when I get back home to
>>>> the US I can take a look and compare the output of the two parsers.
>>>> On Tue, Feb 1, 2011 at 5:01 PM, Graeme Defty <graeme.de...@gmail.com>wrote:
>>>>> Well, I got to the point where all the bultins, library modules etc.
>>>>> are compiling and the unit tests are being executed.
>>>>> The latest stopping point is the following:
>>>>> <HUGE SNIP>
>>>>> E.................
>>>>> =============================Parsing==========================
>>>>> #
>>>>> # MessagingTest: Tests for Reia's asynchronous messaging
>>>>> # Copyright (C)2010 Tony Arcieri
>>>>> #
>>>>> # Redistribution is permitted under the MIT license. See LICENSE for
>>>>> details.
>>>>> #
>>>>> module MessagingTest
>>>>> def run
>>>>> [messaging_test()]
>>>>> end
>>>>> def messaging_test
>>>>> # FIXME: this test could use some work
>>>>> TestHelper.expect("Messaging", "works") do
>>>>> # Send ourselves a message
>>>>> Process.pid() ! (:theanswer, 42)
>>>>> receive
>>>>> when (:theanswer, answer)
>>>>> (42, answer)
>>>>> end
>>>>> end
>>>>> end
>>>>> end
>>>>> --------------------------------------------------------------
>>>>> {{line,8},{column,1}} : got token 'module'
>>>>> {{line,8},{column,8}} : got token '"Mod:MessagingTest"'
>>>>> {{line,9},{column,3}} : got token 'def'
>>>>> {{line,9},{column,7}} : got token '"ID:run"'
>>>>> {{line,10},{column,6}} : got token '"ID:messaging_test"'
>>>>> {{line,10},{column,6}} : got token '"ID:messaging_test"'
>>>>> {{line,10},{column,23}} : got token 'eol'
>>>>> {{line,11},{column,3}} : got token ''end''
>>>>> {{line,13},{column,3}} : got token 'def'
>>>>> {{line,13},{column,7}} : got token '"ID:messaging_test"'
>>>>> {{line,15},{column,5}} : got token '"Mod:TestHelper"'
>>>>> {{line,15},{column,5}} : got token '"Mod:TestHelper"'
>>>>> {{line,15},{column,16}} : got token '"ID:expect"'
>>>>> {{line,15},{column,45}} : got token 'do'
>>>>> {{line,17},{column,7}} : got token '"Mod:Process"'
>>>>> {{line,17},{column,7}} : got token '"Mod:Process"'
>>>>> {{line,17},{column,15}} : got token '"ID:pid"'
>>>>> {{line,17},{column,7}} : got token '"Mod:Process"'
>>>>> {{line,17},{column,7}} : got token '"Mod:Process"'
>>>>> {{line,17},{column,24}} : got token '":theanswer"'
>>>>> {{line,17},{column,24}} : got token '":theanswer"'
>>>>> {{line,17},{column,36}} : got token '"int:42"'
>>>>> {{line,17},{column,36}} : got token '"int:42"'
>>>>> {{line,17},{column,39}} : got token 'eol'
>>>>> {{line,19},{column,7}} : got token ''receive''
>>>>> {{line,20},{column,7}} : got token ''when''
>>>>> {{line,20},{column,13}} : got token '":theanswer"'
>>>>> {{line,20},{column,13}} : got token '":theanswer"'
>>>>> {{line,20},{column,25}} : got token '"ID:answer"'
>>>>> {{line,20},{column,25}} : got token '"ID:answer"'
>>>>> {{line,20},{column,25}} : got token '"ID:answer"'
>>>>> {{line,20},{column,25}} : got token '"ID:answer"'
>>>>> {{line,20},{column,32}} : got token 'eol'
>>>>> {{line,21},{column,10}} : got token '"int:42"'
>>>>> {{line,21},{column,10}} : got token '"int:42"'
>>>>> {{line,21},{column,14}} : got token '"ID:answer"'
>>>>> {{line,21},{column,14}} : got token '"ID:answer"'
>>>>> {{line,21},{column,14}} : got token '"ID:answer"'
>>>>> {{line,21},{column,14}} : got token '"ID:answer"'
>>>>> {{line,21},{column,21}} : got token 'eol'
>>>>> {{line,22},{column,7}} : got token ''end''
>>>>> {{line,19},{column,7}} : got token ''receive''
>>>>> {{line,22},{column,10}} : got token 'eol'
>>>>> {{line,23},{column,5}} : got token ''end''
>>>>> {{line,15},{column,5}} : got token '"Mod:TestHelper"'
>>>>> {{line,15},{column,5}} : got token '"Mod:TestHelper"'
>>>>> {{line,23},{column,8}} : got token 'eol'
>>>>> {{line,24},{column,3}} : got token ''end''
>>>>> {{line,25},{column,1}} : got token ''end''
>>>>> {{line,8},{column,1}} : got token 'module'
>>>>> ----------Parse finished : Result--------
>>>>> [{module,8,'MessagingTest',
>>>>> [{function,9,run,[],
>>>>> {var,1,'_'},
>>>>> [{cons,10,{local_call,10,messaging_test,[],{nil,1}},{empty,10}}]},
>>>>> {function,13,messaging_test,[],
>>>>> {var,1,'_'},
>>>>> [{remote_call,15,
>>>>> {module_name,15,'TestHelper'},
>>>>> expect,
>>>>> [{string,15,"Messaging"},{string,15,"works"}],
>>>>> {lambda,15,[],
>>>>> [{send,17,
>>>>> {remote_call,17,
>>>>> {module_name,17,'Process'},
>>>>> pid,[],
>>>>> {nil,1}},
>>>>> {tuple,17,[{atom,17,theanswer},{integer,17,42}]}},
>>>>> {'receive',19,
>>>>> [{clause,20,
>>>>> [{tuple,20,
>>>>> [{atom,20,theanswer},{var,20,answer}]}],
>>>>> [{tuple,21,[{integer,21,42},{var,21,answer}]}]}],
>>>>> []}]}}]}]}]
>>>>> ----------- End of Parse Result ---------
>>>>> EE
>>>>> \n'List retrieves the nth element correctly' FAILED\nexpected true,
>>>>> actual false\n\n'List replaces elements in pattern matching expressions '
>>>>> FAILED\nexpected [1,42,69], actual 69\n\n'List replaces elements in complex
>>>>> pattern matching expressions ' FAILED\nexpected [8,9,10,4], actual
>>>>> 10\n\n'Tuple retrieves the nth element correctly' FAILED\nexpected true,
>>>>> actual false\n\n'Tuple replaces elements in pattern matching expressions '
>>>>> FAILED\nexpected (1,42,69), actual 69\n\n'Tuple replaces elements in complex
>>>>> pattern matching expressions ' FAILED\nexpected (8,9,10,4), actual
>>>>> 10\n\n'String inspects properly' FAILED\nexpected \""foobar"\", actual
>>>>> \"\"foobar\"\"\n\n'Dict gets values by key' FAILED\nexpected \"bar\", actual
>>>>> {:foo=>\"bar\"}\n\n'Dict casts to a string' FAILED\nexpected
>>>>> \"{:foo=>"bar"}\", actual \"{:foo=>\"bar\"}\"\n\n'Dict inspects properly'
>>>>> FAILED\nexpected \"{:foo=>"bar"}\", actual \"{:foo=>\"bar\"}\"\n\nbuiltins/
>>>>> atom.re ERROR: SyntaxError: /home/graeme/projects/reia/test/builtins/
>>>>> atom_test.re:8: Parse error near "module AtomTest" (Column: 1)\n\tfrom
>>>>> Object: in 'call'
>>>>> \tfrom JsonParser: in 'transform'
>>>>> \tfrom JsonParser: in '-transform/2-lc$^0/1-0-'
>>>>> \tfrom JsonTest: in '-list_test/2-fun-0-'
>>>>> \tfrom TestHelper: in 'expect'
>>>>> \tfrom JsonTest: in 'run'
>>>>> \tfrom /home/graeme/projects/reia/test/runner: in '-toplevel/0-fun-0-'
>>>>> \tfrom lists: in 'map'\n\ncore/object.re ERROR: SyntaxError:
>>>>> /home/graeme/projects/reia/test/core/object_test.re:30: Parse error
>>>>> near "module ObjectTest" (Column: 1)\n\tfrom Object: in 'call'
>>>>> \tfrom JsonParser: in 'transform'
>>>>> \tfrom JsonParser: in '-transform/2-lc$^0/1-0-'
>>>>> \tfrom JsonTest: in '-list_test/2-fun-0-'
>>>>> \tfrom TestHelper: in 'expect'
>>>>> \tfrom JsonTest: in 'run'
>>>>> \tfrom /home/graeme/projects/reia/test/runner: in '-toplevel/0-fun-0-'
>>>>> \tfrom lists: in 'map'\n\ncore/messaging.re ERROR:
>>>>> (:case_clause,[])\n\nlib/json.re ERROR: badarg\n\nexception error: bad
>>>>> argument in an arithmetic expression
>>>>> in function 'TestHelper':duration/2
>>>>> in call from '/home/graeme/projects/reia/test/runner':toplevel/0
>>>>> in call from reia_bytecode:load/2
>>>>> in call from reia_internal:execute_file/1
>>>>> in call from init:start_it/1
>>>>> in call from init:start_em/1
>>>>> I spot a fondness for the third element of everything in the FAILED
>>>>> messages there. Could we be generating bad executable code?
>>>>> I post this here purely as an interesting exercise for the reader -
>>>>> just in case anything obvious leaps out.
>>>>> I have pretty much convinced myself that I need to hack up a way to
>>>>> send each of the *.re modules to the current parser and the PEG and compare
>>>>> the outputs. It is probably quicker in the long run than investigating
>>>>> individual problems, and it will give a much higher level of confidence in
>>>>> the end.
>>>>> Unless you think otherwise?
>>>>> g
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Reia" group.
>>>>> To post to this group, send email to reia@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> reia+unsubscribe@googlegroups.com<reia%2Bunsubscribe@googlegroups.com>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/reia?hl=en.
>>>> --
>>>> Tony Arcieri
>>>> Medioh! Kudelski
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Reia" group.
>>>> To post to this group, send email to reia@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> reia+unsubscribe@googlegroups.com <reia%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/reia?hl=en.
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Reia" group.
>>> To post to this group, send email to reia@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> reia+unsubscribe@googlegroups.com <reia%2Bunsubscribe@googlegroups.com>.
>>> For more options, visit this group at
>>> http://groups.google.com/group/reia?hl=en.
>> --
>> Tony Arcieri
>> Medioh! Kudelski
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Reia" group.
>> To post to this group, send email to reia@googlegroups.com.
>> To unsubscribe from this group, send email to
>> reia+unsubscribe@googlegroups.com <reia%2Bunsubscribe@googlegroups.com>.
>> For more options, visit this group at
>> http://groups.google.com/group/reia?hl=en.