Is possible to use F# pattern matching as a solver/library for another language or DSL? -


i'm building toy language, want have pattern matching. build whole thing (and don't know how) because in f# wonder if can defer whole thing it.

so, have interpreter , custom syntax. if give ast, possible use f# use solve pattern matching?

another way @ this, possible use f# pattern matching c# , other .net languages?

for example, if program (in invented syntax f#):

case x      ( 1 , 2 , three):         print("found 1, 2, or 3!")     else var1:         print("%d" % var1) 

is possible

matched, error = f#magichere.match(evaluatemyast) 

i'm not sure if understand question correctly, suspect use f# compiler service need. basically, compiler service lets call of tasks compiler performs (and normal .net library).

the first step turn ast valid f# code - guess find systematic way of doing (but requires thinking). can use f.c.s to:

  • type-check expression, gives warnings overlapping cases , missing cases (e.g. when have incomplete pattern match).

  • it gives ast of pattern matching , believe can decision tree can interpret evaluate pattern matching.

  • alternatively, use f.c.s compile code , run (provided can translate dsl f# code)


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -