2
3
Fork
You've already forked Wyrm
2
A statically type stack-based language
  • Factor 99.3%
  • C 0.7%
capitalex 2facad3f3f Working on Stuff
C stuff, more examples
2023年09月27日 04:26:29 +00:00
examples Working on Stuff 2023年09月27日 04:26:29 +00:00
lexer Implement support for basics.wyrm 2023年09月21日 19:06:38 -04:00
parser Starting over one last time :^) 2023年09月05日 01:32:32 -04:00
runtime Working on Stuff 2023年09月27日 04:26:29 +00:00
.gitignore Initial Commit 2023年07月23日 02:22:42 -04:00
README.md Starting over one last time :^) 2023年09月05日 01:32:32 -04:00
wyrm.factor Remove unused words 2023年07月25日 17:21:58 -04:00

Wyrm

A statically typed stack-based programming language.

;;
;; A Wyrm program to do a bit of math
;;
vocabulary Main defines
;;
;; Read two floats from the commands line and print their 
;; ratio.
;;
:> print-ratio ( -- )
 :+ ( Console )
 :- ( DivideByZero )
==
 "Enter to numbers: " print-line
 [ read-line >Float64 ] twice / !! 
 to-string print-line ;
:> main ( -- )
 :+ ( Console )
==
 print-ratio case {
 :> DivideByZero => 
 "Can't divide by zero!" print-line ;
 } ;

Wyrm is still early in development, but a list of things I want for the language:

  • Stack-based: Seamlessly chain together operations and return multiple values with ease.

  • Functional: Use functions as values, pass them to other functions, and compose them together.

  • Statically typed: Lean on types to catch stack errors, walk through operations, refactor code, look up definitions, and find useful words.

  • Inferred Types: Compiler can infer the types of expression. Useful for combinators or trivial expressions.

  • Highly refactorable: Extract any line of code, name it, define its types, and then find and replace it. Freely lift expression for re-usage later.

  • Tracked permissions: The type system tracks what side-effects functions need to operate. However, they are unintrusive to the code you write.

  • Composable Types and Implementations: Combine and compose types by treating them as sets. Define open interfaces using structural types.

Inspired a lot by

  • Factor
  • Kitten

Influenced a bit by

  • TypeScript
  • Idris