truj / midica

A Music programming language. Translates source code into MIDI. Includes a player. Supports MIDI-Karaoke. Includes a MIDI analyzer.
https://www.midica.org/
Mozilla Public License 2.0
111 stars 13 forks source link

Support function parameters #38

Closed truj closed 4 years ago

truj commented 4 years ago

Rename MACRO to FUNCTION. Rename INCLUDE to CALL. Support named or unnamed parameters. Example for named parameters:

FUNCTION test
    ${channel}   c  /4  v=${velocity}
END
CALL test(channel=4, velocity=100)  q=2

Example for unnamed parameters:

FUNCTION test
    $[0]   c  /4  v=$[1]
END
CALL test(4, 100)  q=2

The parameters shall still be optional. The following calls are equivalent:

CALL func()
CALL func
truj commented 4 years ago

After these changes, rename INCLUDE_FILE to INCLUDE