Csound Csound-dev Csound-tekno Search About

[Cs-dev] New-Style UDO's

Date2015-02-24 23:47
FromSteven Yi
Subject[Cs-dev] New-Style UDO's
Hi All,

Just an update, I got the basics working now in the feature/parser3
branch for new-style UDO's.  With the following examples of UDO's:

opcode testop, 0, 0
  prints "HELLO WORLD \n"
endop

opcode myadd, i,i
ival xin
xout ival + 1
endop

opcode testop_new():()
  prints "HELLO WORLD 2\n"
endop

opcode myadd_new(ival):(i)
  prints "In myadd_new\n"
  xout ival + 1
endop

opcode myadd_new2(value0:i):(i)
  xout value0 + 1
endop

instr 1

testop()
testop_new()
ival = myadd(4)
print ival

ival2 = myadd_new(4)
print ival2


ival3 = myadd_new2(4)
print ival3

turnoff

endin


The result of running this (full CSD attached) gives:

HELLO WORLD
HELLO WORLD 2
instr 1:  ival = 5.000
In myadd_new
instr 1:  ival2 = 5.000
instr 1:  ival3 = 5.000

Note for new-style UDO's, the current syntax is to use comma separated
args for in-args and out-arg-types.

I do think that the syntax is a little ugly for the out-args.  I'm
wondering about adding these possibilities:

; allow void instead of ()
opcode someOpcode():void
endop

; if single output-arg, allow just single type without parens
opcode someOpcode():i
endop

Now that the new-style UDO's are working, I'll be looking at getting
structs to work as arguments.

Also to note, I rewrote the lexer as I needed to modify things to work
with both old and new-style UDO's.  In doing so, I took out some
things related to newline counting, so that will be off for the
moment.  I'll have that fixed up soon.

Thanks!
steve

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-25 20:17
FromVictor Lazzarini
SubjectRe: [Cs-dev] New-Style UDO's
Looks cool

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 24 Feb 2015, at 23:47, Steven Yi  wrote:
> 
> Hi All,
> 
> Just an update, I got the basics working now in the feature/parser3
> branch for new-style UDO's.  With the following examples of UDO's:
> 
> opcode testop, 0, 0
>  prints "HELLO WORLD \n"
> endop
> 
> opcode myadd, i,i
> ival xin
> xout ival + 1
> endop
> 
> opcode testop_new():()
>  prints "HELLO WORLD 2\n"
> endop
> 
> opcode myadd_new(ival):(i)
>  prints "In myadd_new\n"
>  xout ival + 1
> endop
> 
> opcode myadd_new2(value0:i):(i)
>  xout value0 + 1
> endop
> 
> instr 1
> 
> testop()
> testop_new()
> ival = myadd(4)
> print ival
> 
> ival2 = myadd_new(4)
> print ival2
> 
> 
> ival3 = myadd_new2(4)
> print ival3
> 
> turnoff
> 
> endin
> 
> 
> The result of running this (full CSD attached) gives:
> 
> HELLO WORLD
> HELLO WORLD 2
> instr 1:  ival = 5.000
> In myadd_new
> instr 1:  ival2 = 5.000
> instr 1:  ival3 = 5.000
> 
> Note for new-style UDO's, the current syntax is to use comma separated
> args for in-args and out-arg-types.
> 
> I do think that the syntax is a little ugly for the out-args.  I'm
> wondering about adding these possibilities:
> 
> ; allow void instead of ()
> opcode someOpcode():void
> endop
> 
> ; if single output-arg, allow just single type without parens
> opcode someOpcode():i
> endop
> 
> Now that the new-style UDO's are working, I'll be looking at getting
> structs to work as arguments.
> 
> Also to note, I rewrote the lexer as I needed to modify things to work
> with both old and new-style UDO's.  In doing so, I took out some
> things related to newline counting, so that will be off for the
> moment.  I'll have that fixed up soon.
> 
> Thanks!
> steve
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-25 20:35
FromRory Walsh
SubjectRe: [Cs-dev] New-Style UDO's
Do you mean that you find the empty parenthesis a little ugly? It
Seems fine to me, and consistent with zero input args. Or?

On 24 February 2015 at 23:47, Steven Yi  wrote:
> Hi All,
>
> Just an update, I got the basics working now in the feature/parser3
> branch for new-style UDO's.  With the following examples of UDO's:
>
> opcode testop, 0, 0
>   prints "HELLO WORLD \n"
> endop
>
> opcode myadd, i,i
> ival xin
> xout ival + 1
> endop
>
> opcode testop_new():()
>   prints "HELLO WORLD 2\n"
> endop
>
> opcode myadd_new(ival):(i)
>   prints "In myadd_new\n"
>   xout ival + 1
> endop
>
> opcode myadd_new2(value0:i):(i)
>   xout value0 + 1
> endop
>
> instr 1
>
> testop()
> testop_new()
> ival = myadd(4)
> print ival
>
> ival2 = myadd_new(4)
> print ival2
>
>
> ival3 = myadd_new2(4)
> print ival3
>
> turnoff
>
> endin
>
>
> The result of running this (full CSD attached) gives:
>
> HELLO WORLD
> HELLO WORLD 2
> instr 1:  ival = 5.000
> In myadd_new
> instr 1:  ival2 = 5.000
> instr 1:  ival3 = 5.000
>
> Note for new-style UDO's, the current syntax is to use comma separated
> args for in-args and out-arg-types.
>
> I do think that the syntax is a little ugly for the out-args.  I'm
> wondering about adding these possibilities:
>
> ; allow void instead of ()
> opcode someOpcode():void
> endop
>
> ; if single output-arg, allow just single type without parens
> opcode someOpcode():i
> endop
>
> Now that the new-style UDO's are working, I'll be looking at getting
> structs to work as arguments.
>
> Also to note, I rewrote the lexer as I needed to modify things to work
> with both old and new-style UDO's.  In doing so, I took out some
> things related to newline counting, so that will be off for the
> moment.  I'll have that fixed up soon.
>
> Thanks!
> steve
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-25 22:02
FromSteven Yi
SubjectRe: [Cs-dev] New-Style UDO's
Yeah I find the empty parenthesis it a little ugly. :)  I think what
would be good is to have the option to use void, a single-arg type, or
a list of arg types in parentheses. I think we could keep "()" as
no-args, and really void would be an alias for "()", and "arg-type"
would be an alias for "(arg-type)".

I noticed in go you can have:

func somefunc(a int) int { a + 2}
func somefunc(a int) (int) { return a + 2}

and either way will work with taking in an int and returning a single
int arg. Oddly, you can just leave out any return type altogether if
there is no return value.  I think having void or () or something is a
little more text but usefully more explicit.

On Wed, Feb 25, 2015 at 3:35 PM, Rory Walsh  wrote:
> Do you mean that you find the empty parenthesis a little ugly? It
> Seems fine to me, and consistent with zero input args. Or?
>
> On 24 February 2015 at 23:47, Steven Yi  wrote:
>> Hi All,
>>
>> Just an update, I got the basics working now in the feature/parser3
>> branch for new-style UDO's.  With the following examples of UDO's:
>>
>> opcode testop, 0, 0
>>   prints "HELLO WORLD \n"
>> endop
>>
>> opcode myadd, i,i
>> ival xin
>> xout ival + 1
>> endop
>>
>> opcode testop_new():()
>>   prints "HELLO WORLD 2\n"
>> endop
>>
>> opcode myadd_new(ival):(i)
>>   prints "In myadd_new\n"
>>   xout ival + 1
>> endop
>>
>> opcode myadd_new2(value0:i):(i)
>>   xout value0 + 1
>> endop
>>
>> instr 1
>>
>> testop()
>> testop_new()
>> ival = myadd(4)
>> print ival
>>
>> ival2 = myadd_new(4)
>> print ival2
>>
>>
>> ival3 = myadd_new2(4)
>> print ival3
>>
>> turnoff
>>
>> endin
>>
>>
>> The result of running this (full CSD attached) gives:
>>
>> HELLO WORLD
>> HELLO WORLD 2
>> instr 1:  ival = 5.000
>> In myadd_new
>> instr 1:  ival2 = 5.000
>> instr 1:  ival3 = 5.000
>>
>> Note for new-style UDO's, the current syntax is to use comma separated
>> args for in-args and out-arg-types.
>>
>> I do think that the syntax is a little ugly for the out-args.  I'm
>> wondering about adding these possibilities:
>>
>> ; allow void instead of ()
>> opcode someOpcode():void
>> endop
>>
>> ; if single output-arg, allow just single type without parens
>> opcode someOpcode():i
>> endop
>>
>> Now that the new-style UDO's are working, I'll be looking at getting
>> structs to work as arguments.
>>
>> Also to note, I rewrote the lexer as I needed to modify things to work
>> with both old and new-style UDO's.  In doing so, I took out some
>> things related to newline counting, so that will be off for the
>> moment.  I'll have that fixed up soon.
>>
>> Thanks!
>> steve
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>> things parallel software development, from weekly thought leadership blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-26 00:12
FromRory Walsh
SubjectRe: [Cs-dev] New-Style UDO's
> there is no return value.  I think having void or () or something is a
> little more text but usefully more explicit.

Me too. I'm also Ok with the colon. I prefer it to a comma. After all,
colons are part of a smiley face :)

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-26 03:18
FromSteven Yi
SubjectRe: [Cs-dev] New-Style UDO's
:)

Just FYI, I added void and single arg-type to new-style UDO def's.
The following now works:

opcode test_void():void
  prints "HELLO WORLD : VOID\n"
endop

opcode test_single_out_type(value:i):i
  xout value + 1
endop


On Wed, Feb 25, 2015 at 7:12 PM, Rory Walsh  wrote:
>> there is no return value.  I think having void or () or something is a
>> little more text but usefully more explicit.
>
> Me too. I'm also Ok with the colon. I prefer it to a comma. After all,
> colons are part of a smiley face :)
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-26 09:18
FromRory Walsh
SubjectRe: [Cs-dev] New-Style UDO's
Great. Is the new parser available online anywhere yet? I would like
to follow your examples with a few experiments so that I can get my
head around what's happening.

On 26 February 2015 at 03:18, Steven Yi  wrote:
> :)
>
> Just FYI, I added void and single arg-type to new-style UDO def's.
> The following now works:
>
> opcode test_void():void
>   prints "HELLO WORLD : VOID\n"
> endop
>
> opcode test_single_out_type(value:i):i
>   xout value + 1
> endop
>
>
> On Wed, Feb 25, 2015 at 7:12 PM, Rory Walsh  wrote:
>>> there is no return value.  I think having void or () or something is a
>>> little more text but usefully more explicit.
>>
>> Me too. I'm also Ok with the colon. I prefer it to a comma. After all,
>> colons are part of a smiley face :)
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>> things parallel software development, from weekly thought leadership blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-26 13:36
FromSteven Yi
SubjectRe: [Cs-dev] New-Style UDO's
No sorry, it's not at this time.  It's taking up enough time just to
get this working. :P Some of the changes from the past two days are
dealing with some hairy stuff.  I think after this next bit of work
getting structs to work with UDO's, I can publish a web page for
testing.

On Thu, Feb 26, 2015 at 4:18 AM, Rory Walsh  wrote:
> Great. Is the new parser available online anywhere yet? I would like
> to follow your examples with a few experiments so that I can get my
> head around what's happening.
>
> On 26 February 2015 at 03:18, Steven Yi  wrote:
>> :)
>>
>> Just FYI, I added void and single arg-type to new-style UDO def's.
>> The following now works:
>>
>> opcode test_void():void
>>   prints "HELLO WORLD : VOID\n"
>> endop
>>
>> opcode test_single_out_type(value:i):i
>>   xout value + 1
>> endop
>>
>>
>> On Wed, Feb 25, 2015 at 7:12 PM, Rory Walsh  wrote:
>>>> there is no return value.  I think having void or () or something is a
>>>> little more text but usefully more explicit.
>>>
>>> Me too. I'm also Ok with the colon. I prefer it to a comma. After all,
>>> colons are part of a smiley face :)
>>>
>>> ------------------------------------------------------------------------------
>>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>>> things parallel software development, from weekly thought leadership blogs to
>>> news, videos, case studies, tutorials and more. Take a look and join the
>>> conversation now. http://goparallel.sourceforge.net/
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>> things parallel software development, from weekly thought leadership blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2015-02-26 14:01
FromRory Walsh
SubjectRe: [Cs-dev] New-Style UDO's
Great. Please take your time. It's really great stuff that you are
doing. It has Csound7 written all over it ;)

On 26 February 2015 at 13:36, Steven Yi  wrote:
> No sorry, it's not at this time.  It's taking up enough time just to
> get this working. :P Some of the changes from the past two days are
> dealing with some hairy stuff.  I think after this next bit of work
> getting structs to work with UDO's, I can publish a web page for
> testing.
>
> On Thu, Feb 26, 2015 at 4:18 AM, Rory Walsh  wrote:
>> Great. Is the new parser available online anywhere yet? I would like
>> to follow your examples with a few experiments so that I can get my
>> head around what's happening.
>>
>> On 26 February 2015 at 03:18, Steven Yi  wrote:
>>> :)
>>>
>>> Just FYI, I added void and single arg-type to new-style UDO def's.
>>> The following now works:
>>>
>>> opcode test_void():void
>>>   prints "HELLO WORLD : VOID\n"
>>> endop
>>>
>>> opcode test_single_out_type(value:i):i
>>>   xout value + 1
>>> endop
>>>
>>>
>>> On Wed, Feb 25, 2015 at 7:12 PM, Rory Walsh  wrote:
>>>>> there is no return value.  I think having void or () or something is a
>>>>> little more text but usefully more explicit.
>>>>
>>>> Me too. I'm also Ok with the colon. I prefer it to a comma. After all,
>>>> colons are part of a smiley face :)
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>>>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>>>> things parallel software development, from weekly thought leadership blogs to
>>>> news, videos, case studies, tutorials and more. Take a look and join the
>>>> conversation now. http://goparallel.sourceforge.net/
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>> ------------------------------------------------------------------------------
>>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>>> things parallel software development, from weekly thought leadership blogs to
>>> news, videos, case studies, tutorials and more. Take a look and join the
>>> conversation now. http://goparallel.sourceforge.net/
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>> things parallel software development, from weekly thought leadership blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net