Csound Csound-dev Csound-tekno Search About

[Cs-dev] more parser trouble

Date2010-10-06 22:58
FromVictor Lazzarini
Subject[Cs-dev] more parser trouble
Hi John,

with the new parser, I am getting this:

csound_orcerror: syntax error, unexpected T_IDENT, expecting S_COM or  
S_NL
Parsing failed due to invalid input!
Csound tidy up: Bus error

with the below CSD (runs OK with old parser). Also should we not get a  
more graceful exit on parsing errors?
(NB: this is one of qutecsound's examples).
================================


--midi-key-cps=4 --midi-velocity=5


sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1
maxalloc 1,1 ; Monophonic synth
massign 0, 1
instr 1 ; Additive Synth
kgoto skipinit
if p4 != 0 then
outvalue "freq", p4
endif
skipinit:
kreset invalue "reset"
kresettrig changed kreset
if kresettrig == 1 then
if kreset == 1 then
reinit skipinit
endif
endif
kamp1 invalue "amp1"
kamp2 invalue "amp2"
kamp3 invalue "amp3"
kamp4 invalue "amp4"
kamp5 invalue "amp5"
kamp6 invalue "amp6"
kamp7 invalue "amp7"
kamp8 invalue "amp8"
kamp9 invalue "amp9"
kamp10 invalue "amp10"
kamp11 invalue "amp11"
kamp12 invalue "amp12"
kfactor1 invalue "fac1"
kfactor2 invalue "fac2"
kfactor3 invalue "fac3"
kfactor4 invalue "fac4"
kfactor5 invalue "fac5"
kfactor6 invalue "fac6"
kfactor7 invalue "fac7"
kfactor8 invalue "fac8"
kfactor9 invalue "fac9"
kfactor10 invalue "fac10"
kfactor11 invalue "fac11"
kfactor12 invalue "fac12"
kfreq invalue "freq"
kfreq portk kfreq, 0.02, i(kfreq) ; Smooth frequency values
kfreq1 = kfreq * kfactor1
kfreq2 = kfreq * kfactor2
kfreq3 = kfreq * kfactor3
kfreq4 = kfreq * kfactor4
kfreq5 = kfreq * kfactor5
kfreq6 = kfreq * kfactor6
kfreq7 = kfreq * kfactor7
kfreq8 = kfreq * kfactor8
kfreq9 = kfreq * kfactor9
kfreq10 = kfreq * kfactor10
kfreq11 = kfreq * kfactor11
kfreq12 = kfreq * kfactor12
aosc1 poscil3 kamp1, kfreq1, 1, 0
aosc2 poscil3 kamp2, kfreq2, 1, 0
aosc3 poscil3 kamp3, kfreq3, 1, 0
aosc4 poscil3 kamp4, kfreq4, 1, 0
aosc5 poscil3 kamp5, kfreq5, 1, 0
aosc6 poscil3 kamp6, kfreq6, 1, 0
aosc7 poscil3 kamp7, kfreq7, 1, 0
aosc8 poscil3 kamp8, kfreq8, 1, 0
aosc9 poscil3 kamp9, kfreq9, 1, 0
aosc10 poscil3 kamp10, kfreq10, 1, 0
aosc11 poscil3 kamp11, kfreq11, 1, 0
aosc12 poscil3 kamp12, kfreq12, 1, 0
outvalue "freq1", kfreq1
outvalue "freq2", kfreq2
outvalue "freq3", kfreq3
outvalue "freq4", kfreq4
outvalue "freq5", kfreq5
outvalue "freq6", kfreq6
outvalue "freq7", kfreq7
outvalue "freq8", kfreq8
outvalue "freq9", kfreq9
outvalue "freq10", kfreq10
outvalue "freq11", kfreq11
outvalue "freq12", kfreq12
asig = aosc1 + aosc2 + aosc3 + aosc4 + aosc5 + aosc6 + aosc7 + aosc8 +  
aosc9 + aosc10 + aosc11 + aosc12
klevel invalue "level"
outs asig*klevel, asig*klevel
endin
instr 99 ; Always on
krel invalue "rel"
kon invalue "on"
kfreq invalue "freq"
konchanged changed kon
ktrig changed krel, kon
if konchanged == 1 then
if kon == 1 then
event "i", 1, 0, -1, kfreq
else
turnoff2 1, 0, 0
endif
endif
if ktrig == 1 then
if krel == 0 then
outvalue "fac1", 1
outvalue "fac2", 2
outvalue "fac3", 3
outvalue "fac4", 4
outvalue "fac5", 5
outvalue "fac6", 6
outvalue "fac7", 7
outvalue "fac8", 8
outvalue "fac9", 9
outvalue "fac10", 10
outvalue "fac11", 11
outvalue "fac12", 12
elseif krel == 1 then
outvalue "fac1", 1
outvalue "fac2", 3
outvalue "fac3", 5
outvalue "fac4", 7
outvalue "fac5", 9
outvalue "fac6", 11
outvalue "fac7", 13
outvalue "fac8", 15
outvalue "fac9", 17
outvalue "fac10", 19
outvalue "fac11", 21
outvalue "fac12", 23
elseif krel == 2 then
outvalue "fac1", 1
outvalue "fac2", 1.22
outvalue "fac3", 1.3
outvalue "fac4", 1.35
outvalue "fac5", 1.45
outvalue "fac6", 1.64
outvalue "fac7", 1.7
outvalue "fac8", 1.78
outvalue "fac9", 1.79
outvalue "fac10", 1.81
outvalue "fac11", 1.91
outvalue "fac12", 1.98
elseif krel == 3 then
outvalue "fac1", 1
outvalue "fac2", 2.22
outvalue "fac3", 3.3
outvalue "fac4", 4.35
outvalue "fac5", 5.45
outvalue "fac6", 6.64
outvalue "fac7", 7.7
outvalue "fac8", 8.78
outvalue "fac9", 9.79
outvalue "fac10", 10.81
outvalue "fac11", 11.91
outvalue "fac12", 12.98
elseif krel == 4 then
outvalue "fac1", 1.02
outvalue "fac2", 1.05
outvalue "fac3", 1.12
outvalue "fac4", 1.14
outvalue "fac5", 1.19
outvalue "fac6", 1.21
outvalue "fac7", 1.26
outvalue "fac8", 1.29
outvalue "fac9", 1.32
outvalue "fac10", 1.35
outvalue "fac11", 1.36
outvalue "fac12", 1.39
endif
endif
endin
instr 100 ; Set amplitude to 1 over partial number
outvalue "amp1", 1/1
outvalue "amp2", 1/2
outvalue "amp3", 1/3
outvalue "amp4", 1/4
outvalue "amp5", 1/5
outvalue "amp6", 1/6
outvalue "amp7", 1/7
outvalue "amp8", 1/8
outvalue "amp9", 1/9
outvalue "amp10", 1/10
outvalue "amp11", 1/11
outvalue "amp12", 1/12
turnoff
endin


f 1 0 4096 10 1
i 99 0 3600
e



------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-10-06 23:15
FromVictor Lazzarini
SubjectRe: [Cs-dev] more parser trouble
To simplify the diagnostics, the offending code is

if kresettrig == 1 then
    if kreset == 1 then
       reinit skipinit  ;   <==== THIS LINE breaks the parser
    endif
endif

[but why? that is the question]

Victor

On 6 Oct 2010, at 22:58, Victor Lazzarini wrote:

> Hi John,
>
> with the new parser, I am getting this:
>
> csound_orcerror: syntax error, unexpected T_IDENT, expecting S_COM or
> S_NL
> Parsing failed due to invalid input!
> Csound tidy up: Bus error
>
> with the below CSD (runs OK with old parser). Also should we not get a
> more graceful exit on parsing errors?
> (NB: this is one of qutecsound's examples).
> ================================
> 
> 
> --midi-key-cps=4 --midi-velocity=5
> 
> 
> sr = 44100
> ksmps = 128
> nchnls = 2
> 0dbfs = 1
> maxalloc 1,1 ; Monophonic synth
> massign 0, 1
> instr 1 ; Additive Synth
> kgoto skipinit
> if p4 != 0 then
> outvalue "freq", p4
> endif
> skipinit:
> kreset invalue "reset"
> kresettrig changed kreset
> if kresettrig == 1 then
> if kreset == 1 then
> reinit skipinit
> endif
> endif
> kamp1 invalue "amp1"
> kamp2 invalue "amp2"
> kamp3 invalue "amp3"
> kamp4 invalue "amp4"
> kamp5 invalue "amp5"
> kamp6 invalue "amp6"
> kamp7 invalue "amp7"
> kamp8 invalue "amp8"
> kamp9 invalue "amp9"
> kamp10 invalue "amp10"
> kamp11 invalue "amp11"
> kamp12 invalue "amp12"
> kfactor1 invalue "fac1"
> kfactor2 invalue "fac2"
> kfactor3 invalue "fac3"
> kfactor4 invalue "fac4"
> kfactor5 invalue "fac5"
> kfactor6 invalue "fac6"
> kfactor7 invalue "fac7"
> kfactor8 invalue "fac8"
> kfactor9 invalue "fac9"
> kfactor10 invalue "fac10"
> kfactor11 invalue "fac11"
> kfactor12 invalue "fac12"
> kfreq invalue "freq"
> kfreq portk kfreq, 0.02, i(kfreq) ; Smooth frequency values
> kfreq1 = kfreq * kfactor1
> kfreq2 = kfreq * kfactor2
> kfreq3 = kfreq * kfactor3
> kfreq4 = kfreq * kfactor4
> kfreq5 = kfreq * kfactor5
> kfreq6 = kfreq * kfactor6
> kfreq7 = kfreq * kfactor7
> kfreq8 = kfreq * kfactor8
> kfreq9 = kfreq * kfactor9
> kfreq10 = kfreq * kfactor10
> kfreq11 = kfreq * kfactor11
> kfreq12 = kfreq * kfactor12
> aosc1 poscil3 kamp1, kfreq1, 1, 0
> aosc2 poscil3 kamp2, kfreq2, 1, 0
> aosc3 poscil3 kamp3, kfreq3, 1, 0
> aosc4 poscil3 kamp4, kfreq4, 1, 0
> aosc5 poscil3 kamp5, kfreq5, 1, 0
> aosc6 poscil3 kamp6, kfreq6, 1, 0
> aosc7 poscil3 kamp7, kfreq7, 1, 0
> aosc8 poscil3 kamp8, kfreq8, 1, 0
> aosc9 poscil3 kamp9, kfreq9, 1, 0
> aosc10 poscil3 kamp10, kfreq10, 1, 0
> aosc11 poscil3 kamp11, kfreq11, 1, 0
> aosc12 poscil3 kamp12, kfreq12, 1, 0
> outvalue "freq1", kfreq1
> outvalue "freq2", kfreq2
> outvalue "freq3", kfreq3
> outvalue "freq4", kfreq4
> outvalue "freq5", kfreq5
> outvalue "freq6", kfreq6
> outvalue "freq7", kfreq7
> outvalue "freq8", kfreq8
> outvalue "freq9", kfreq9
> outvalue "freq10", kfreq10
> outvalue "freq11", kfreq11
> outvalue "freq12", kfreq12
> asig = aosc1 + aosc2 + aosc3 + aosc4 + aosc5 + aosc6 + aosc7 + aosc8 +
> aosc9 + aosc10 + aosc11 + aosc12
> klevel invalue "level"
> outs asig*klevel, asig*klevel
> endin
> instr 99 ; Always on
> krel invalue "rel"
> kon invalue "on"
> kfreq invalue "freq"
> konchanged changed kon
> ktrig changed krel, kon
> if konchanged == 1 then
> if kon == 1 then
> event "i", 1, 0, -1, kfreq
> else
> turnoff2 1, 0, 0
> endif
> endif
> if ktrig == 1 then
> if krel == 0 then
> outvalue "fac1", 1
> outvalue "fac2", 2
> outvalue "fac3", 3
> outvalue "fac4", 4
> outvalue "fac5", 5
> outvalue "fac6", 6
> outvalue "fac7", 7
> outvalue "fac8", 8
> outvalue "fac9", 9
> outvalue "fac10", 10
> outvalue "fac11", 11
> outvalue "fac12", 12
> elseif krel == 1 then
> outvalue "fac1", 1
> outvalue "fac2", 3
> outvalue "fac3", 5
> outvalue "fac4", 7
> outvalue "fac5", 9
> outvalue "fac6", 11
> outvalue "fac7", 13
> outvalue "fac8", 15
> outvalue "fac9", 17
> outvalue "fac10", 19
> outvalue "fac11", 21
> outvalue "fac12", 23
> elseif krel == 2 then
> outvalue "fac1", 1
> outvalue "fac2", 1.22
> outvalue "fac3", 1.3
> outvalue "fac4", 1.35
> outvalue "fac5", 1.45
> outvalue "fac6", 1.64
> outvalue "fac7", 1.7
> outvalue "fac8", 1.78
> outvalue "fac9", 1.79
> outvalue "fac10", 1.81
> outvalue "fac11", 1.91
> outvalue "fac12", 1.98
> elseif krel == 3 then
> outvalue "fac1", 1
> outvalue "fac2", 2.22
> outvalue "fac3", 3.3
> outvalue "fac4", 4.35
> outvalue "fac5", 5.45
> outvalue "fac6", 6.64
> outvalue "fac7", 7.7
> outvalue "fac8", 8.78
> outvalue "fac9", 9.79
> outvalue "fac10", 10.81
> outvalue "fac11", 11.91
> outvalue "fac12", 12.98
> elseif krel == 4 then
> outvalue "fac1", 1.02
> outvalue "fac2", 1.05
> outvalue "fac3", 1.12
> outvalue "fac4", 1.14
> outvalue "fac5", 1.19
> outvalue "fac6", 1.21
> outvalue "fac7", 1.26
> outvalue "fac8", 1.29
> outvalue "fac9", 1.32
> outvalue "fac10", 1.35
> outvalue "fac11", 1.36
> outvalue "fac12", 1.39
> endif
> endif
> endin
> instr 100 ; Set amplitude to 1 over partial number
> outvalue "amp1", 1/1
> outvalue "amp2", 1/2
> outvalue "amp3", 1/3
> outvalue "amp4", 1/4
> outvalue "amp5", 1/5
> outvalue "amp6", 1/6
> outvalue "amp7", 1/7
> outvalue "amp8", 1/8
> outvalue "amp9", 1/9
> outvalue "amp10", 1/10
> outvalue "amp11", 1/11
> outvalue "amp12", 1/12
> turnoff
> endin
> 
> 
> f 1 0 4096 10 1
> i 99 0 3600
> e
> 
> 
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating  
> great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-10-12 07:07
Fromjohn ffitch
SubjectRe: [Cs-dev] more parser trouble
I think the reinit parsing problem is now fixed.

The problem was that labels were not allowed in exprlists

==John ffitch

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net