Skip to content

frame-lang/framec

Framepiler

CI License Version

framec (aka the framepiler) — is the transpiler for the Frame language. Currently framec supports output to 17 target languges + Graphviz. Frame is a domain-specific language for specifying state machines that transpiles to production code in multiple target languages. You write @@system blocks inside your native source files, and the framepiler expands them into full state machine implementations. All native code passes through unchanged — your native compiler handles everything outside the @@system blocks and other @@ tagged pragmas and statements.

Quick Start

cargo install framec

Create a file hello.fpy:

@@[target("python_3")]

@@system Hello {
    interface:
        greet()

    machine:
        $Start {
            greet() {
                print(f"Hello, {self.name}!")
            }
        }

    domain:
        name = "World"
}

if __name__ == "__main__":
    h = @@Hello()
    h.greet()

Transpile and run:

framec hello.fpy         # emits hello.py
python3 hello.py         # prints: Hello, World!

Supported Languages

Core

Language Target Name Extension
Python python_3 .fpy
TypeScript typescript .fts
JavaScript javascript .fjs
C c .fc
C++ cpp .fcpp
C# csharp .fcs
Java java .fjava
Rust rust .frs
Go go .fgo

Experimental

Kotlin, Swift, PHP, Ruby, Lua, Erlang, Dart, GDScript

Visualization

Output Target Name
GraphViz DOT graphviz

Usage

# Transpile to Python (auto-detected from @@target in file)
framec myfile.fpy

# Override target language
framec -l typescript myfile.frm

# Transpile all files in a directory
framec compile-project -l python_3 -o ./output ./src

# Generate state chart
framec -l graphviz myfile.frm | dot -Tpng -o chart.png

# See all options
framec --help

Documentation

License

Apache License 2.0

About

framec is the compiler for the Frame language — aka the framepiler. Written in Rust, it transpiles state machines (automata) to 17 production languages plus Graphviz.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages