POV-Ray : Newsgroups : povray.bugreports : array mixed crashes in parser Server Time
24 Jun 2021 08:29:22 EDT (-0400)
  array mixed crashes in parser (Message 11 to 14 of 14)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 11 Jul 2019 19:05:00
Message: <web.5d27beab3c87cc69799a5f510@news.povray.org>
Thanks for all your coaching so far. I'm not certain whether these are hints to
a solution or hints to a work-around.

One hint was array initialization. Another hint was about substitution. This
helped me deconstruct why my specific implementation may function or break:

Recall, this is the thrown error:
"Possible Parse Error: Uncategorized error thrown at
/Volumes/WDVrijstuk/PovRayUnofficial_3.8.0-alpha. 10013324-avx
source/source/parser/parser_tokenizer.cpp line 2413."

// ==== THIS FAILS ====
#declare SampleSystem2 = dictionary  {
 .LeftMain2515:  array mixed[3][4] {
  { 1001, 1, array[20][2],array[20][2] },
  { 1023, 1, array[10] {0,0,0,0,0,0,0,0,0,0}, array[10]{0,0,0,0,0,0,0,0,0,0}},
  { 1036, 1, array[10] {0,0,0,0,0,0,0,0,0,0}, array[10]{0,0,0,0,0,0,0,0,0,0}},
  }
 .RightMain2515: array mixed[3][4] {
  { 1016, 1, array[20][2] , array[20][2] },
  { 1023, 1, array[10]{0,0,0,0,0,0,0,0,0,0},array[10]{0,0,0,0,0,0,0,0,0,0}},
  { 1002, 1, array[20][2] , array[20][2] },
  }
 .Keyboard:   array[1] { 3212 }
};

// ==== THIS DOES NOT GENERATE ERROR  ====
#declare initVect20 = array[20][2] ;
#declare initZero5 = array[10]{0,0,0,0,0,0,0,0,0,0};
#declare SampleSystem2 = dictionary  {
 .LeftMain2515:  array mixed[3][4] {
  { 1001, 1, initVect20 , initVect20 },
  { 1023, 1,initZero10, initZero10 },
  { 1036, 1,initZero10, initZero10 },
  }
 .RightMain2515: array mixed[3][4] {
  { 1016, 1, initVect20 , initVect20 },
  { 1023, 1,initZero10, initZero10 },
  { 1002, 1, initVect20 , initVect20 },
  }
 .Keyboard:   array[1] { 3212 }
};


It doesn't stop there, but I think I'm describing the problem. My next post
will demonstrate further the complexity of implementing "mixed-type" elements.


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 11 Jul 2019 20:40:00
Message: <web.5d27cc333c87cc69799a5f510@news.povray.org>
Time to change the Subject line

Again, I'm not going to peruse the code. That's above my pay grade and those
that are gefingerpoken it will sort it out. [Ref:
https://en.wikipedia.org/wiki/Blinkenlights]

Possible Parse Error: Uncategorized error thrown at
/Volumes/WDVrijstuk/PovRayUnofficial_3.8.0-alpha. 10013324-avx
source/source/parser/parser_tokenizer.cpp line 2413.


//==== THIS GENERATES ERROR ====
#declare ColorDictionary = array mixed[2] {
 dictionary  { // Upper
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10  // Do you think this would?
//  ["1001"]: initZero10  // And why was it a workaround
//  ["1002"]: initZero10  // In my previous post
 },
 dictionary {  // Lower
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10  // Ibidem
//  ["1001"]: initZero10  // That's ibidem-way in Pig Latin
 }
};


//==== Que Voila? THIS DOES NOT GENERATE ERROR
#declare ColorDictionary = array[2] { dictionary, dictionary };

#macro initARPSliderCapColorDictionary()
 #declare ARPSliderCapColorDictionary[0] = dictionary  { // Upper
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10
//  ["1001"]: initZero10 // But this does when used ---
//            ^^^^^^^ Parse Error: Expected 'numeric expression',
string literal found instead
//  ["1002"]: initZero10 //
// };

 #declare ColorDictionary[1] = dictionary {  // Lower
  ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
  ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
//  ["0"      ]: initZero10  // As above
//  ["1001"]: initZero10
// So <Return> is not necessarily the terminating character for dictionary
containers
 };
#end

initARPSliderCapColorDictionary()



So, consume these experiments in all their richness while I re-code the project.
The next chapter is to find out what is generating a hard crash in
3.8.0-alpha.10013324 but not in 3.8.0-alpha.9844500


Post a reply to this message

From: jr
Subject: Re: array mixed crashes in parser
Date: 12 Jul 2019 11:20:00
Message: <web.5d28a47f3c87cc693936914a0@news.povray.org>
hi,

"TreeLimb Jim" <all### [at] yahoocom> wrote:
> Possible Parse Error: ...
> //==== THIS GENERATES ERROR ====
> #declare ColorDictionary = array mixed[2] {
>  dictionary  { // Upper
>   ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
>   ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
>   ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
>   ...


I think the problem is due to the names you give to the keys.  iiuc, the first
character cannot be a digit (3.3.1.10 Array, cf indices follow generic rules for
identifiers).


regards, jr.


Post a reply to this message

From: TreeLimb Jim
Subject: Re: array mixed crashes in parser
Date: 16 Jul 2019 00:35:00
Message: <web.5d2d50f23c87cc69799a5f510@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> > //==== THIS GENERATES ERROR ====
> > #declare ColorDictionary = array mixed[2] {
> >  dictionary  { // Upper
> >   ["0"      ]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
> >   ["1001"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
> >   ["1002"]: array[10] { 0,0,0,0,0, 0,0,0,0,0 }
> >   ...

Fixed quite a few things in my code. Best behavior so far:
1. >>>IMPORTANT<<< Dictionary names must be STRING but the initial character
must be an alpha character. This must be documented somewhere already. It makes
it handy to use
the dot delimiter as well as not to confuse elements inside the square brackets
as elements of an array.

2. Declare the array of dictionaries and THEN initialize them as in the
following rewrite:

#declare ColorDictionary = array mixed[2] { dictionary, dictionary }
#declare init10 = array[10] { 0,0,0,0,0, 0,0,0,0,0 }

#macro initColorDictionary()
// Upper
  #declare ColorDictionary[0].m0 = init10
  #declare ColorDictionary[0].m1001 = init10
  #declare ColorDictionary[0].m1002 = init10
// Lower
  #declare ColorDictionary[1].m0 = init10
  #declare ColorDictionary[1].m1001 = init10
  #declare ColorDictionary[1].m1002 = init10
#end

initColorDictionary()


I believe I'm getting closer to coding around a few things about concurrently
declaring and initializing but not simultaneously declare and initializing
arrays, including the superset called mixed arrays.

From preliminary explorations, in mixed arrays, my suggestion during alpha
development is to keep the same data type as initialized for that element and
quite likely, the dimension of the arrays and elements composed of arrays, too.
( brings memories of the horrors of writing context-free grammars and LEX/YACC )


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.