The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
# Usage:
#   util/compile_p6grammar.pl examples/langs2.grammar > Langs2.pm
#   perl -MLangs2 -e 'print My::VB->def("Dim a, b As double")->{"My::C.var_list"}, "\n"'

# We use 'rule' instead of 'token' in this file
# (compared to examples/langs.grammar)

grammar My::C;

rule def {
    <type> <var_list> ';'
}

token type { int | float | double | char }

rule var_list {
    <ident>**{1} [ ',' <ident> ]*
}

grammar My::VB;

rule def {
    'Dim' <My::C.var_list>
    [ 'As' <My::C.type> ]?
}