You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far Ling has a backend to C. However supporting multiple target language would be interesting.
Go seems like a good target language which would strike a balance between modern and efficient.
While Go has a GC, it is claimed that "Go gives the programmer considerable control over memory layout and allocation, much more than is typical in garbage-collected languages." which seems just about what we need.
The task would be to follow what has been done for C.
Here is a rough roadmap:
AST/Printer for Go
While there is a package on hackage it seems unmaintained and incomplete.
Moreover we do not need a something complete as we target a small subset anyway (at least at first).
So I would recommend writing down the grammar for the subset we are interested in using BNFC.
Ling.Compile.C
This module converts a sequentialized Ling program to C, what matters the most are the following parts:
Ling terms gets translated to Go expressions (starting with function application and literals)
Ling actions gets translated to Go statments (starting with send/recv, then new, then split)
Ling processes defined at top-level gets translated to Go functions (no return type, at first only basic sessions such ?Int and !Int)
Ling sessions and types gets translated to Go types (atomic types such as Int and Double, then arrays of those)
Let's keep in mind that the processes are sequentialized at that point. So new(c:S,d) declares a variable l of a type translated from S and we now track c and d has being associated to l.
The command send c t assigns the result of the expression translated from t to the location associated to c. The command recv c (x : A) assigns the variable associated to c to a local variable derived from x.
The text was updated successfully, but these errors were encountered:
So far Ling has a backend to C. However supporting multiple target language would be interesting.
Go seems like a good target language which would strike a balance between modern and efficient.
While Go has a GC, it is claimed that "Go gives the programmer considerable control over memory layout and allocation, much more than is typical in garbage-collected languages." which seems just about what we need.
The task would be to follow what has been done for C.
Here is a rough roadmap:
AST/Printer for Go
While there is a package on hackage it seems unmaintained and incomplete.
Moreover we do not need a something complete as we target a small subset anyway (at least at first).
So I would recommend writing down the grammar for the subset we are interested in using BNFC.
Ling.Compile.C
This module converts a sequentialized Ling program to C, what matters the most are the following parts:
?Int
and!Int
)Int
andDouble
, then arrays of those)Let's keep in mind that the processes are sequentialized at that point. So
new(c:S,d)
declares a variablel
of a type translated fromS
and we now trackc
andd
has being associated tol
.The command
send c t
assigns the result of the expression translated fromt
to the location associated toc
. The commandrecv c (x : A)
assigns the variable associated toc
to a local variable derived fromx
.The text was updated successfully, but these errors were encountered: