Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underscores in local variable names #3

Open
frans-bergman opened this issue Feb 22, 2023 · 1 comment
Open

Underscores in local variable names #3

frans-bergman opened this issue Feb 22, 2023 · 1 comment
Assignees

Comments

@frans-bergman
Copy link

Most modern programming languages allow using underscores in variable names. Figure 1 in this paper (https://arxiv.org/pdf/2201.06312.pdf) also suggests that underscores should be allowed in variable names. However, when defining a local variable with an underscore in its name, parsing fails.

Can support for underscores in variable names (and other identifiers) be added?

Example of non-working recipe script (cLink has been replaced with c_link):

channels: c, empty, g1, g2,vmm1,vmm2,vmm3,t
enum rolevals {clnt, vm, mgr}
enum msgvals {reserve, request, release, buy, connect, full,complete}
message-structure: MSG : msgvals, LNK : channel
communication-variables: cv : rolevals
guard g(r : rolevals, c : channel, m : channel) := (channel == *) && (@cv == r) | (channel == c) && (@cv == mgr) | (channel == m) ;

agent Client
    local: role : rolevals, c_link : channel, mLink : channel, tLink : channel
    init: c_link == c && mLink == empty && tLink == t && role==clnt
    relabel:
        cv <- role
    receive-guard: (channel == *) | (channel == c_link) | (channel == tLink)

    repeat: (
            (sReserve: <c_link==c> *! g(role,c_link,mLink)(MSG := reserve)[c_link := c]
            +
            rReserve: < c_link==c && MSG == reserve> *? [c_link := empty]
            )
            ;

            (sRequest: <c_link!=empty> c_link! g(role,c_link,mLink)(MSG := request)[c_link := c];
             rConnect: <mLink==empty && MSG == connect> c_link? [mLink := LNK];
             sRelease: <TRUE> *! g(role,c_link,mLink)(MSG := release)[c_link := empty];
             sBuy: <mLink!=empty> mLink! g(role,c_link,mLink)(MSG := buy)[mLink := empty];
             (
                sSolve: <TRUE> tLink! g(role,c_link,tLink)(MSG := complete)[]
               +
                <MSG == complete> tLink? []
             )

            +
             rRelease: <c_link==empty && MSG == release> *? [c_link := c]
            )
            )

agent Manager
    local: role : rolevals, c_link : channel, sLink : channel, hLink : channel
    init: hLink == g1 && sLink == g2 && c_link == c && role==mgr
    relabel:
        cv <- role
    receive-guard: (channel == *) | (channel == c_link) | (channel == hLink)

    repeat: (
            rRequest: <MSG == request> c_link? [];
            sForward: <TRUE> hLink! (TRUE)(MSG := request)[];
            (
             rep (rFull: <MSG == full> hLink? [];
                  sRequest: <TRUE> sLink! (TRUE)(MSG := request)[]
                 )
             +
             rConnect: <MSG == connect> c_link? []
            )
            )

agent Machine
    local: gLink : channel, pLink : channel, c_link : channel, asgn : bool
    init: !asgn && (c_link == empty)
    relabel:
        cv <- vm
    receive-guard: (channel == *) | (channel == gLink)  | (channel == pLink) | (channel == c_link)

    repeat: (
           rForward: <c_link==empty && MSG == request> gLink? [c_link:= c];
            (
             sConnect: <c_link==c && !asgn> c_link! (TRUE)(MSG := connect, LNK := pLink)[c_link:= empty, asgn:= TRUE]
             +
             sFull: <c_link==c && asgn> gLink! (TRUE)(MSG := full)[c_link:= empty, asgn:= TRUE]
             +
             rConnect: <c_link==c && MSG == connect> c_link? [c_link:= empty]


             +
             rFull: <c_link==c && asgn && MSG == full> gLink? [c_link:= empty, asgn:= TRUE]
            )
            +
            rBuy: <MSG == buy> pLink? []
            )

system = Client(client1,TRUE) | Client(client2,TRUE) | Client(client3,TRUE) |  Manager(manager,TRUE) | Machine(machine1,gLink==g1 && pLink==vmm1) | Machine(machine2,gLink==g1 && pLink==vmm2) | Machine(machine3,gLink==g2 && pLink==vmm3)

SPEC G ( (F(client1-mLink!=empty) & F (client2-mLink!=empty) & F (client3-mLink!=empty)) -> F (client1-sSolve | client2-sSolve | client3-sSolve));
@shaunazzopardi
Copy link
Member

Good idea, will implement this change soon.

@shaunazzopardi shaunazzopardi self-assigned this Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants