Kappa-Dev / KappaTools

Tool suite for kappa models. Documentation and binaries can be found in the release section. Try it online at
http://kappalanguage.org/
GNU Lesser General Public License v3.0
112 stars 41 forks source link

Inconsistent behavior in snapshot naming between KaSimInBrowser and KaSimInCommandLine for `[E]` #660

Closed hmedina closed 1 year ago

hmedina commented 1 year ago

Using the toy example:

%mod: [true] do $SNAPSHOT "snap_".[E].".ka" [true]; repeat [true]

%agent: timer(s{tik tok})   %init: 1 timer()
timer(s{tik}) <-> timer(s{tok}) @ 1, 1
%mod: [E] = 5 do $STOP ;

KaSimInBrowser names snapshots like snap_[E].ka, snap_[E]_1.ka, whereas KaSimInCommandLine names snapshots like snap_0.ka, snap_1.ka, properly using the [E] symbol for event number.

feret commented 1 year ago

In the following example, %mod: [true] do $SNAPSHOT "snap".[E].".ka" ; %mod: [true] do $SNAPSHOT "snap"."[E]".".ka" ; both lines are translated the same way in json.

It is important to distinguish macro, from raw strings.

feret commented 1 year ago

I have added a term constructor to distinguish algebraic constructor from regular strings.

feret commented 1 year ago

@hmedina I have committed a tentative fix in the branch distinguish_algexpr_in_json. Could you check that it is answering your concern ? If so, I will merge in the main branch.

hmedina commented 1 year ago

I didn't see a way of building a Windows executable KappApp, so I tested against building site/index.html, and ./_build/install/default/bin/WebSim, and the snapshots are named as expected.

Using [E] uses the simulator's event number, [T] the simulator's time, [Tsim] the host's time spent, and [E-] the number of null events; where appropriate, files got _n suffixes to prevent name clashes, as is expected.