Go to file
VaclavT 9ab0a2c98d callstack added 2021-04-09 00:07:20 +02:00
.vscode doc updates 2021-03-15 23:37:05 +01:00
clib compile on linux 2021-03-29 23:18:29 +02:00
doc fixes & enhandcements 2021-03-14 16:15:04 +01:00
stdlib some comments and Readme changes 2021-03-28 13:46:12 +02:00
tests added string functions 2021-03-28 13:42:53 +02:00
tmp debug changes 2021-03-07 17:23:09 +01:00
.gitignore small lisp updates 2021-02-21 21:53:45 +01:00
CMakeLists.txt split by regexp and [rl]tring added 2021-03-24 00:18:27 +01:00
Readme.md callstack added 2021-04-09 00:07:20 +02:00
debug.lsp callstack added 2021-04-09 00:07:20 +02:00
ml.cpp callstack added 2021-04-09 00:07:20 +02:00
ml.h load stdlib code bit simplyfied 2021-03-22 06:52:10 +01:00
ml_date.cpp int is dead, long live long type! 2021-03-17 23:56:02 +01:00
ml_date.h int is dead, long live long type! 2021-03-17 23:56:02 +01:00
ml_io.cpp fix for non existing dirs in ls-dir 2021-03-22 06:50:46 +01:00
ml_io.h include path changes 2021-02-26 09:49:01 +01:00
ml_profiler.cpp callstack added 2021-04-09 00:07:20 +02:00
ml_profiler.h callstack added 2021-04-09 00:07:20 +02:00
ml_string.cpp added string functions 2021-03-28 13:42:53 +02:00
ml_string.h added string functions 2021-03-28 13:42:53 +02:00
ml_util.cpp move list of builtins to ml_util.cpp 2021-03-15 23:24:58 +01:00
ml_util.h fixes & enhandcements 2021-03-14 16:15:04 +01:00

Readme.md

BUGS

  • (read-file "nonexisting/file.csv") shows only "could not open file" - should print filename
  • error: the expression ("/usr/local/var/mlisp") with message "cannot cast" - should add to what is casting
  • better error reporting..for example ls_dir on non existing dir should prind pwd dir

TODO

  • add debug support, at least call stack
  • add stdtest - to test every functionality
  • add parenthesis coloring into linenoise
  • multiline editing (kilo editor)
  • execute system command should capture stderr
  • add some mem stats to benchmark
  • create pastebin like web using ml

Code

  • documentation
  • rename constants in ml_profiler.h
  • replace to_string macro in ml.cpp
  • add url of source/inspiration to clib/*.cpp
  • add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc)

Language

  • support for (), nil, t, in lsp code replace 0 by nil in logicals
  • file functions
    • open file
    • read line
    • write line
    • close file
  • string functions
    • itok - integer to char, chartoint (better names) - mini printf can be useed for it (%d)
    • compare - needed for sorting, cmp ignore case
    • regexp functions
  • date support
    • decode-universal-time
  • env functions
    • get-env, set-env; set-env cannot be implemented in stdlib.lsp, because popen is in fact subshell
  • format (sprintf)
  • setq
  • mapcar (funcall, apply)
  • syntax highlighting do VS Code
  • add hash datatype

Performance

  • define is one of most frequent callee, when in scope with very few vars, lookup sequentially
  • push_back - repeatedly without reserving size
  • range - with for(int i...) and reserving result size can be 3times faster on (range 1 10000)
  • mini_sprintf - unnecesary copying between vector and list
  • (do, scope ..) repeatedly assign to acc

Compile

mkdir -p build
gcc -std=c99 -c -O2 -o linenoise.o clib/linenoise.c
c++ -c -O2  -I/usr/local/opt/openssl/include -Iclib --std=c++17  ml.cpp ml_io.cpp ml_date.cpp ml_string.cpp ml_util.cpp ml_profiler.cpp clib/json11.cpp clib/csvparser.cpp clib/sslclient.cpp clib/printf.cpp
// on linux c++ -o build/ml -O2 -L/usr/local/lib -L/usr/local/opt/openssl/lib -lm -lstdc++ -lcrypto -lssl *.o
c++ -o build/ml -O2 -L/usr/local/lib -L/usr/local/opt/openssl/lib -lm -lstdc++ -lcrypto -lssl -Wl,-stack_size -Wl,0x1000000 *.o

// or cmake

Install

cp build/ml /usr/local/bin/ml
cp stdlib/*.lsp /usr/local/var/mlisp/

Example of use

./build/ml -f debug.lisp

https://markdowntohtml.com/ https://hyperpolyglot.org/lisp https://www.tutorialspoint.com/lisp/index.htm https://github.com/adam-mcdaniel/wisp http://www.ulisp.com/show?1AWG http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/

https://github.com/dropbox/json11

std::vector

https://stackoverflow.com/questions/12271017/initial-capacity-of-vector-in-c https://baptiste-wicht.com/posts/2012/12/cpp-benchmark-vector-list-deque.html

parse http headers in c++

^(?:((?:https?|s?ftp):)\/\/)([^:\/\s]+)(?::(\d*))?(?:\/([^\s?#]+)?([?][^?#]*)?(#.*)?)?

https://stackoverflow.com/questions/25896916/parse-http-headers-in-c

read stdout and stderr from popen

https://stackoverflow.com/questions/478898/how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-po

VPS providers

https://www.skysilk.com/cloud/pricing/#classId=Standard&section=2 https://contabo.com/en/ https://www.hetzner.com/de/

Editor

https://viewsourcecode.org/snaptoken/kilo/07.syntaxHighlighting.html http://antirez.com/news/108 https://github.com/antirez/kilo