Function call syntax

1 view
Skip to first unread message

kim

unread,
Mar 14, 2010, 12:30:09 PM3/14/10
to Reia
I am trying to understand the current syntax of Reia and I am looking
over the reia_parse.yrl file. There seems to be an inconsistency in
how the arguments to a call are parsed depending on whether it is a
local call or not. For local calls, the yecc rules use the pargs
nonterminal for the optional argument list. The rules for pargs
consist of a comma separated list of arguments with an optional block
capture on the end. This optional block capture is not recorded in
the #local_call record and is therefor ignored if it exists. The
remote call and native call rules both use an optional argument list
that is just a comma separated list of arguments without the optional
block capture. I would think all three types of call would use the
same grammar rules for parsing arguments. Have I missed something?

As an aside, I am working on a PEG grammar for Reia using neotoma.
This is just a learning exercise for me since I have never done a PEG
grammar before. My goal is to get it parsing Reia and passing all the
tests. If I get that far, would you be interested in it?

Tony Arcieri

unread,
Mar 15, 2010, 2:19:06 AM3/15/10
to re...@googlegroups.com
On Sun, Mar 14, 2010 at 10:30 AM, kim <k...@westryn.net> wrote:
I am trying to understand the current syntax of Reia and I am looking
over the reia_parse.yrl file.  There seems to be an inconsistency in
how the arguments to a call are parsed depending on whether it is a
local call or not.  For local calls, the yecc rules use the pargs
nonterminal for the optional argument list.  The rules for pargs
consist of a comma separated list of arguments with an optional block
capture on the end.  This optional block capture is not recorded in
the #local_call record and is therefor ignored if it exists.

I'm not sure why you think the block capture is being discarded.  See the usage of the ?pargs_default_block macro in cases where there is no literal block.
 
The remote call and native call rules both use an optional argument list
that is just a comma separated list of arguments without the optional
block capture.  I would think all three types of call would use the
same grammar rules for parsing arguments.  Have I missed something?

No, #remote_call should also use pargs but hasn't been converted yet.  #native_call shouldn't because it needs to use Erlang call semantics, which don't support things like blocks.
 
As an aside, I am working on a PEG grammar for Reia using neotoma.
This is just a learning exercise for me since I have never done a PEG
grammar before.  My goal is to get it parsing Reia and passing all the
tests.  If I get that far, would you be interested in it?

Yes, definitely.  There are a number of problems with the current grammar that could be addressed by a PEG.
 
--
Tony Arcieri
Medioh! A Kudelski Brand

Kim Shrier

unread,
Mar 15, 2010, 12:11:25 PM3/15/10
to re...@googlegroups.com

On Mar 15, 2010, at 12:19 AM, Tony Arcieri wrote:

> On Sun, Mar 14, 2010 at 10:30 AM, kim <k...@westryn.net> wrote:
> I am trying to understand the current syntax of Reia and I am looking
> over the reia_parse.yrl file. There seems to be an inconsistency in
> how the arguments to a call are parsed depending on whether it is a
> local call or not. For local calls, the yecc rules use the pargs
> nonterminal for the optional argument list. The rules for pargs
> consist of a comma separated list of arguments with an optional block
> capture on the end. This optional block capture is not recorded in
> the #local_call record and is therefor ignored if it exists.
>
> I'm not sure why you think the block capture is being discarded.
> See the usage of the ?pargs_default_block macro in cases where there
> is no literal block.
>

So I did miss something. Thanks for pointing that out.

> The remote call and native call rules both use an optional argument
> list
> that is just a comma separated list of arguments without the optional
> block capture. I would think all three types of call would use the
> same grammar rules for parsing arguments. Have I missed something?
>
> No, #remote_call should also use pargs but hasn't been converted
> yet. #native_call shouldn't because it needs to use Erlang call
> semantics, which don't support things like blocks.
>

Once again, thanks for the additional information.

> As an aside, I am working on a PEG grammar for Reia using neotoma.
> This is just a learning exercise for me since I have never done a PEG
> grammar before. My goal is to get it parsing Reia and passing all the
> tests. If I get that far, would you be interested in it?
>
> Yes, definitely. There are a number of problems with the current
> grammar that could be addressed by a PEG.
>

We'll see if I can get this working. I am doing a lot of experimenting
with selected parts of the grammar and finding that my CFG reflexes get
in the way.

> --
> Tony Arcieri
> Medioh! A Kudelski Brand
>

--
Kim Shrier - principal, Shrier and Deihl - mailto:k...@westryn.net
Remote Unix Network Admin, Security, Internet Software Development
westryn.net - Superior FreeBSD-based Web Hosting
http://www.westryn.net


Reply all
Reply to author
Forward
0 new messages