[Csnd] parser3 features: explicit types

Hi everyone,

I thought I should start some posts on features of parser3 which is part of Csound 7. There are several new things that Steven has made available which you might find interesting to use. Since there is not yet any documentation, I thought I should start discussing these and then we can see to making pages about it.

In this post, I'll introduce explicit typing. We can now give variables any names by specifying their types on declaration.
The syntax for this is:

name:type

where type is a,k,i, etc

For example

instr 1
dur:i = filelen("trololo.wav")
p3 = dur
left:a,right:a = diskin("trololo.wav")
out(left,right)
endin

Another thing to note about the example above is that multiple outputs from functions is now working. Same principles
apply to the "classic" syntax

instr 2
dur:i filelen "trololo.wav"
p3 = dur
left:a,right:a diskin "trololo.wav"
out left,right
endin

Victor

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Hello Victor!
Feb 8 2022, Victor Lazzarini has written:
...

In this post, I'll introduce explicit typing.

...

left:a,right:a = diskin("trololo.wav")

...
Personally, I don't know which of these two features gives me more
pleasure to see. I think it might be the assignment for multiple
outputs. I occasionally found myself doing that without thinking. :slight_smile: I
am looking forward to parser3. I expect there will be other tricks up
its sleeve.

Best wishes,

Jeanette

great stuff. thanks so much, victor, for posts like this one. i can perhaps start a chapter in the floss manual based on these.

  joachim

yes, I find these features very nice too. Note that it's all working already in the version we have in the develop branch. Another thing about parser3 is that it seems much easier to maintain and extend.

Thanks, we will need to start documenting these things properly.

Thanks Victor. I am very excited about the features offered by the new parser, especially structs and the new UDO syntax.
Steven's thesis (particularly chapters 2.4 and 3.3) is very interesting in that regard.

Are dictionaries/hash tables also scheduled for the next release?

Pierre

I guess they are, we need to see what we can get done before we can call it ready to release.
There's a lot of tickets to go through.