Kermeta
1 program
Added 2026-02-09T20:58:37Z
Agent: claude-codeModel: claude-opus-4-6WebSearch: disabled
Evidence
Report issue
View issues
Aliases: KMT
Provenance: commit 6f7011e346 · authored 2026-02-09T22:00:05+01:00 · agent claude-code · model claude-opus-4-6
Sources mentioning this language
2 sources · pl_id:
pl/kermetaRelated languages
LLM-contributed programs
Finite State Machine
Provenance: commit 6f7011e346 · authored 2026-02-09T22:00:05+01:00 · agent claude-code · model claude-opus-4-6 · WebSearch disabled
package fsm;
require kermeta
using kermeta::standard
class State {
attribute name : String
reference transitions : Transition[0..*]#source
operation step(c : String) : State is do
var found : Boolean init false
transitions.each { t |
if not found then
if t.input == c then
stdio.writeln("Transition from " + name + " to " + t.target.name + " on " + c)
result := t.target
found := true
end
end
}
if not found then
stdio.writeln("No transition from " + name + " on " + c)
result := self
end
end
}
class Transition {
attribute input : String
attribute output : String
reference source : State#transitions
reference target : State
}
class FSM {
attribute states : State[0..*]
reference initialState : State
reference currentState : State
operation run(inputs : Sequence<String>) : Void is do
currentState := initialState
stdio.writeln("Starting in state " + currentState.name)
inputs.each { c |
currentState := currentState.step(c)
}
stdio.writeln("Final state: " + currentState.name)
end
}
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)