Everything you need to get started
git clone https://github.com/gokr/harding.git
cd harding
nimble local
Requires Nim 2.2.6+
harding # Start REPL
harding script.hrd # Run a script
harding -e "3 + 4" # Evaluate
Use --loglevel DEBUG for verbose output
code --install-extension \
harding-lang-0.1.0.vsix
Syntax highlighting for .hrd files
"Hello, World!" println
factorial := [:n |
(n <= 1) ifTrue: [^ 1].
^ n * (factorial value: (n - 1))
]
(factorial value: 5) println
Counter := Object derive: #(count)
Counter extend: [
self >> initialize [ count := 0 ]
self >> increment [
count := count + 1.
^ count
]
]
c := Counter new
c initialize
c increment println
numbers := #(1 2 3 4 5)
squares := numbers collect: [:n | n * n]
evens := numbers select: [:n | (n \ 2) = 0]
sum := numbers inject: 0 into: [:a :n | a + n]
| Feature | Smalltalk | Harding |
|---|---|---|
| Comments | "comment" |
# comment |
| Strings | 'string' |
"string" |
| Statement separator | Period . only |
Period or newline |
| Class creation | Class definition | Object derive: #(vars) |
| Persistence | Image-based | File-based, git-friendly |
| Execution | VM | VM or Native compilation (future) |
| Inheritance | Single | Multiple |