Csound Csound-dev Csound-tekno Search About

[Cs-dev] new parser error

Date2011-10-08 19:48
Frommenno
Subject[Cs-dev] new parser error
Hi,

finally found time to get work done for the manual, i get an error using
this example with the new parser:



; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o turnoff.wav -W ;;; for file output any platform



sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

k1 expon 440, p3/10, 880	;begin gliss and continue
   printk .1, k1		;prints frequency every tenth of a second
if k1 < sr/2  kgoto contin	;until Nyquist detected
   turnoff  			;then quits

contin:
  asig oscil 1, k1, 1
       outs asig, asig

endin



f 1 0 32768 10 1	;sine

i 1 0 4			;plays for 4 seconds, but gets turned off after 2.3 seconds
e



greetings,
Menno

--
View this message in context: http://csound.1045644.n5.nabble.com/new-parser-error-tp4883532p4883532.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2011-10-08 20:35
FromVictor Lazzarini
SubjectRe: [Cs-dev] new parser error
It appears what is upsetting the parser is the presence of sr/2  in  
the truth expression. If you substitute that with a constant or
another variable (like an i-time one), it works.

ex.:

iend = sr/2

...

if k1 < iend kgoto contin

No problems. So I guess now it's a matter of finding why.

Victor

On 8 Oct 2011, at 19:48, menno wrote:

> Hi,
>
> finally found time to get work done for the manual, i get an error  
> using
> this example with the new parser:
>
> 
> 
> ; Select audio/midi flags here according to platform
> -odac     ;;;realtime audio out
> ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
> ; For Non-realtime ouput leave only the line below:
> ; -o turnoff.wav -W ;;; for file output any platform
> 
> 
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs  = 1
>
> instr 1
>
> k1 expon 440, p3/10, 880	;begin gliss and continue
>   printk .1, k1		;prints frequency every tenth of a second
> if k1 < sr/2  kgoto contin	;until Nyquist detected
>   turnoff  			;then quits
>
> contin:
>  asig oscil 1, k1, 1
>       outs asig, asig
>
> endin
>
> 
> 
> f 1 0 32768 10 1	;sine
>
> i 1 0 4			;plays for 4 seconds, but gets turned off after 2.3 seconds
> e
> 
> 
>
> greetings,
> Menno
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/new-parser-error-tp4883532p4883532.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously  
> valuable.
> Why? It contains a definitive record of application performance,  
> security
> threats, fraudulent activity, and more. Splunk takes this data and  
> makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2011-10-08 20:56
FromVictor Lazzarini
SubjectRe: [Cs-dev] new parser error
It appears the problem is to do with any arithmetic expression.

if k1  <  iend/2 ...

will not do as well.

Victor

On 8 Oct 2011, at 20:35, Victor Lazzarini wrote:

> It appears what is upsetting the parser is the presence of sr/2  in
> the truth expression. If you substitute that with a constant or
> another variable (like an i-time one), it works.
>
> ex.:
>
> iend = sr/2
>
> ...
>
> if k1 < iend kgoto contin
>
> No problems. So I guess now it's a matter of finding why.
>
> Victor
>
> On 8 Oct 2011, at 19:48, menno wrote:
>
>> Hi,
>>
>> finally found time to get work done for the manual, i get an error
>> using
>> this example with the new parser:
>>
>> 
>> 
>> ; Select audio/midi flags here according to platform
>> -odac     ;;;realtime audio out
>> ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
>> ; For Non-realtime ouput leave only the line below:
>> ; -o turnoff.wav -W ;;; for file output any platform
>> 
>> 
>>
>> sr = 44100
>> ksmps = 32
>> nchnls = 2
>> 0dbfs  = 1
>>
>> instr 1
>>
>> k1 expon 440, p3/10, 880	;begin gliss and continue
>>  printk .1, k1		;prints frequency every tenth of a second
>> if k1 < sr/2  kgoto contin	;until Nyquist detected
>>  turnoff  			;then quits
>>
>> contin:
>> asig oscil 1, k1, 1
>>      outs asig, asig
>>
>> endin
>>
>> 
>> 
>> f 1 0 32768 10 1	;sine
>>
>> i 1 0 4			;plays for 4 seconds, but gets turned off after 2.3 seconds
>> e
>> 
>> 
>>
>> greetings,
>> Menno
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/new-parser-error-tp4883532p4883532.html
>> Sent from the Csound - Dev mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------------------------------
>> All of the data generated in your IT infrastructure is seriously
>> valuable.
>> Why? It contains a definitive record of application performance,
>> security
>> threats, fraudulent activity, and more. Splunk takes this data and
>> makes
>> sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-d2dcopy2
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously  
> valuable.
> Why? It contains a definitive record of application performance,  
> security
> threats, fraudulent activity, and more. Splunk takes this data and  
> makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2011-10-08 23:46
FromSteven Yi
SubjectRe: [Cs-dev] new parser error
I made a unit test (will commit after this email).  I ran with debug
parsing, and it shows that the it is parsing correctly but in
csound_orc_expressions.c, when it goes to expand the boolean
expression (the k1 < sr/2 part), the boolean expression code is
assuming the right hand side is already expanded and trying to get a
value from the right hand token, which happens to be the "/".  That
TREE* node has no value and therefore causes a bad memory access.

I'll commit the test and see if I can modify the code; it should
probably check both left and right hand sides to see if either is an
expression, if so, expand them, then continue on with expanding the
boolean.

(gdb output below)

Thanks!
steven

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x0000000100106211 in create_boolean_expression (csound=0x100800000,
root=0x101325670) at csound_orc_expressions.c:560
560	      csound->Message(csound, "Operator Found: %s (%c %c)\n", op,
(gdb) bt
#0  0x0000000100106211 in create_boolean_expression
(csound=0x100800000, root=0x101325670) at csound_orc_expressions.c:560
#1  0x000000010010689e in csound_orc_expand_expressions
(csound=0x100800000, root=0x101324f10) at csound_orc_expressions.c:669
#2  0x000000010010675d in csound_orc_expand_expressions
(csound=0x100800000, root=0x101300760) at csound_orc_expressions.c:650
#3  0x000000010010d184 in new_orc_parser (csound=0x100800000) at
new_orc_parser.c:107
#4  0x00000001000ea558 in csoundCompile (csound=0x100800000, argc=2,
argv=0x7fff5fbffab0) at main.c:337
#5  0x0000000100001cfa in main (argc=3, argv=0x7fff5fbffab0) at
csound_main.c:136
(gdb) print op
$1 = 0x101325fd0 "<"
(gdb) print root->left->value
$2 = (ORCTOKEN *) 0x1013253f0
(gdb) print root->right->value
$3 = (ORCTOKEN *) 0x0


On Sat, Oct 8, 2011 at 8:56 PM, Victor Lazzarini
 wrote:
> It appears the problem is to do with any arithmetic expression.
>
> if k1  <  iend/2 ...
>
> will not do as well.
>
> Victor
>
> On 8 Oct 2011, at 20:35, Victor Lazzarini wrote:
>
>> It appears what is upsetting the parser is the presence of sr/2  in
>> the truth expression. If you substitute that with a constant or
>> another variable (like an i-time one), it works.
>>
>> ex.:
>>
>> iend = sr/2
>>
>> ...
>>
>> if k1 < iend kgoto contin
>>
>> No problems. So I guess now it's a matter of finding why.
>>
>> Victor
>>
>> On 8 Oct 2011, at 19:48, menno wrote:
>>
>>> Hi,
>>>
>>> finally found time to get work done for the manual, i get an error
>>> using
>>> this example with the new parser:
>>>
>>> 
>>> 
>>> ; Select audio/midi flags here according to platform
>>> -odac     ;;;realtime audio out
>>> ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
>>> ; For Non-realtime ouput leave only the line below:
>>> ; -o turnoff.wav -W ;;; for file output any platform
>>> 
>>> 
>>>
>>> sr = 44100
>>> ksmps = 32
>>> nchnls = 2
>>> 0dbfs  = 1
>>>
>>> instr 1
>>>
>>> k1 expon 440, p3/10, 880     ;begin gliss and continue
>>>  printk .1, k1               ;prints frequency every tenth of a second
>>> if k1 < sr/2  kgoto contin   ;until Nyquist detected
>>>  turnoff                     ;then quits
>>>
>>> contin:
>>> asig oscil 1, k1, 1
>>>      outs asig, asig
>>>
>>> endin
>>>
>>> 
>>> 
>>> f 1 0 32768 10 1     ;sine
>>>
>>> i 1 0 4                      ;plays for 4 seconds, but gets turned off after 2.3 seconds
>>> e
>>> 
>>> 
>>>
>>> greetings,
>>> Menno
>>>
>>> --
>>> View this message in context: http://csound.1045644.n5.nabble.com/new-parser-error-tp4883532p4883532.html
>>> Sent from the Csound - Dev mailing list archive at Nabble.com.
>>>
>>> ------------------------------------------------------------------------------
>>> All of the data generated in your IT infrastructure is seriously
>>> valuable.
>>> Why? It contains a definitive record of application performance,
>>> security
>>> threats, fraudulent activity, and more. Splunk takes this data and
>>> makes
>>> sense of it. IT sense. And common sense.
>>> http://p.sf.net/sfu/splunk-d2dcopy2
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> All of the data generated in your IT infrastructure is seriously
>> valuable.
>> Why? It contains a definitive record of application performance,
>> security
>> threats, fraudulent activity, and more. Splunk takes this data and
>> makes
>> sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-d2dcopy2
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net