Skip to content

timfame/dsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MIT license

DSL for my own language
Examples:

mainFunc = twoArgFunc $ \a1 a2 returnValue -> 
  (##) (22 :: Int) $ \funny ->
  (##) (33 :: Int) $ \scared ->
  funny *= (!!) (555 :: Int) \\
  scared += (!!) (42.2 :: Double) %+% ($$) scared \\
  funny -= (!!) (100 :: Int) \\
    iff (a1 ~=~ ($$) funny ~&&~ a2 ~=~ ($$) scared)
      (returnValue === (!!) (100 :: Int))
      (returnValue === (!!) (-100 :: Int))`
log2 = oneArgFunc $ \a logCnt ->
  (##) (0 :: Int) $ \accum ->
  accum === (!!) (1 :: Int) \\
  logCnt === (!!) (0 :: Int) \\
  while (a ~>~ ($$) accum)
    ( accum *= (!!) (2 :: Int) \\
      logCnt += (!!) (1 :: Int)
    )

To try it, run stack ghci and use runMainFunc or runLog2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published