You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
20 hours ago | |
---|---|---|
aoc/day01 | 20 hours ago | |
.gitignore | 2 weeks ago | |
README.md | 3 days ago | |
interpreter.py | 22 hours ago | |
lexer.py | 20 hours ago | |
neb.py | 5 days ago | |
parser.py | 1 day ago | |
repl.py | 4 days ago | |
structs.py | 1 day ago |
README.md
neb
an attempt at a language
ideas
- Lisp-y: I hope you like parentheses!
- Strongly typed: types are Good, and could enable future compilation
- We <3 Linux: strong support for pipelines and shell-ing out
- Immutable variables: mutability is scary and makes for strange bugs
- Pure functions: side effects are also scary
things that (hopefully) work
housekeeping
- TODO
(exit [[status :int]]) => :bool
io
(print [out :string]) => :bool ; print to stdout
- TODO
(print-all [strings :list]) => :bool ; a list of strings
math
(+ [arg :number] [many :number]) => :number
(- [arg :number] [many :number]) => :number
(* [arg :number] [many :number]) => :number
(/ [num :number] [denom :number]) => :number
string
- TODO
(concat [arg :string] [many :string]) => :string
flow control
(if [cond :bool] [t-branch :any|:expr] [[f-branch :any|:expr]]) => :any
(for-count [count :int] [many :expr]) => :any ; creates 'idx' variable with loop count
(| [first :expr] [many :expr]) => :any ; creates 'items' variable
(branch ([cond1 :bool] [expr1 :any]) [([condN: :bool] [exprN :any])]) => :any
type checking TODO
(string? [arg :any]) => :bool
(int? [arg :any]) => :bool
(float? [arg :any]) => :bool
(number? [arg :any]) => :bool ; returns #true for :int or :float
(bool? [arg :any]) => :bool
type conversion TODO
(int->string [arg :int]) => :string
(float->string [arg :float]) => :string
(number->string [arg :number]) => :string
(bool->string [arg :bool]) => :string
(->string [arg :literal]) => :string ; works for all literals
global variables
(def [name :string] [value :expr]) => ?
shell TODO
($ [command :string]) => :list ; doesn't support pipes, first item is return code
($| [commands :list]) => :bool ; pipes together multiple shell commands
functions
- `(lambda (args) (expr1) (expr2) ... (exprN)) => :any
other
- pretty much nothing else
TODO (this section may be incomplete)
types
- revisit type system when i understand gestures broadly
parsing
- build an AST like a real person (sorta?)
math
- division (float)
- division (int)
- mod (int)
- exponent
strings
- concat
- substring
- lower/uppercase
flow control
- if
- if with empty else
- branch
- pipe
lists
- lex
- parse
- evaluate
other structure things
- generic struct?
- dict?
symbols
- define
- access
shell
- call out
- pipe