[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parsing order for matrices
From: |
Daniel J Sebald |
Subject: |
Parsing order for matrices |
Date: |
Thu, 18 Oct 2012 02:50:52 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
In trying to observe the
whitespace-between-function-name-and-parenthesis I noticed the following
behavior:
octave:27> zeros (1, 10)
ans =
0 0 0 0 0 0 0 0 0 0
octave:28> [zeros (1, 10)]
parse error:
syntax error
[zeros (1, 10)]
^
octave:28> [zeros(1, 10)]
ans =
0 0 0 0 0 0 0 0 0 0
Is it correct that the second case should be invalid and syntax error?
I'm guessing that the parsing of the whole matrix comes before parsing
of the elements, i.e., on the first pass Octave thinks the second case
is ["zeros" "(1, 10)"]. Notice that Octave never gets to the stage of
evaluating "zeros" otherwise that too would have been a syntax error.
It seems to me that the algorithm could be altered slightly to evaluate
an individual element before proceeding to the next element. I can't
think of any ambiguity off hand.
Dan
- Parsing order for matrices,
Daniel J Sebald <=