Change name
This commit is contained in:
parent
77a0831254
commit
d3fae1110d
4
Makefile
4
Makefile
|
|
@ -7,7 +7,7 @@ obj_dir = build
|
||||||
object_paths = $(addprefix $(obj_dir)/, $(objects))
|
object_paths = $(addprefix $(obj_dir)/, $(objects))
|
||||||
|
|
||||||
|
|
||||||
inf: $(object_paths)
|
milly: $(object_paths)
|
||||||
$(CC) -o $@ $(CFLAGS) $(object_paths)
|
$(CC) -o $@ $(CFLAGS) $(object_paths)
|
||||||
|
|
||||||
$(obj_dir)/%.o: src/%.c include/*.h | $(obj_dir)
|
$(obj_dir)/%.o: src/%.c include/*.h | $(obj_dir)
|
||||||
|
|
@ -26,7 +26,7 @@ $(obj_dir):
|
||||||
mkdir -p $(obj_dir)
|
mkdir -p $(obj_dir)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f inf
|
rm -f milly
|
||||||
rm -f reference_parser
|
rm -f reference_parser
|
||||||
rm -r $(obj_dir)
|
rm -r $(obj_dir)
|
||||||
|
|
||||||
|
|
|
||||||
14
README.md
14
README.md
|
|
@ -1,12 +1,12 @@
|
||||||
# inf
|
# milly
|
||||||
|
|
||||||
inf is an hobby, and should not be taken seriously.
|
milly is an hobby, and should not be taken seriously.
|
||||||
|
|
||||||
Interpreter for a Minimal ML-like language whose ideal goal is to be used for bootstrapping compilers and interpreters.
|
Interpreter for a Minimal ML-like language whose ideal goal is to be used for bootstrapping compilers and interpreters.
|
||||||
|
|
||||||
## How to build
|
## How to build
|
||||||
|
|
||||||
inf's interpreter is written in portable ISO C11, sources are in `src/` and header files are in `include/`.
|
milly's interpreter is written in portable ISO C11, sources are in `src/` and header files are in `include/`.
|
||||||
|
|
||||||
If your system happens to have a `make` implementation compatible with **GNU Make**, you can just run:
|
If your system happens to have a `make` implementation compatible with **GNU Make**, you can just run:
|
||||||
|
|
||||||
|
|
@ -14,11 +14,11 @@ If your system happens to have a `make` implementation compatible with **GNU Mak
|
||||||
|
|
||||||
Otherwise, something like this should work:
|
Otherwise, something like this should work:
|
||||||
|
|
||||||
> $(CC) -std=c11 -o inf -Iinclude/ src/*.c
|
> $(CC) -std=c11 -o milly -Iinclude/ src/*.c
|
||||||
|
|
||||||
## The language
|
## The language
|
||||||
|
|
||||||
inf is a minimal dialect of Standard ML and Haskell,
|
milly is a minimal dialect of Standard ML and Haskell,
|
||||||
here is a list of the features (or better, limitations) I want to introduce:
|
here is a list of the features (or better, limitations) I want to introduce:
|
||||||
|
|
||||||
- Keep the implementation <5000 LOC
|
- Keep the implementation <5000 LOC
|
||||||
|
|
@ -34,9 +34,9 @@ here is a list of the features (or better, limitations) I want to introduce:
|
||||||
- Delimited continuations (this is an overkill)
|
- Delimited continuations (this is an overkill)
|
||||||
- Easy syntax allowing easy kakoune support
|
- Easy syntax allowing easy kakoune support
|
||||||
|
|
||||||
inf's full grammar is specified as a pair of lex and yacc files in `ref_parser/`.
|
milly's full grammar is specified as a pair of lex and yacc files in `ref_parser/`.
|
||||||
|
|
||||||
kakoune plugin for inf is in `extra/inf.kak`.
|
kakoune plugin for milly is in `extra/milly.kak`.
|
||||||
|
|
||||||
Here is a small example of the syntax:
|
Here is a small example of the syntax:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
# Detection
|
|
||||||
hook global BufCreate .*\.(mil) %{
|
|
||||||
set-option buffer filetype inf
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=inf %{
|
|
||||||
require-module inf
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
hook -group inf-highlighter global WinSetOption filetype=inf %{
|
|
||||||
add-highlighter window/inf ref inf
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{
|
|
||||||
remove-highlighter window/inf
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
provide-module inf %§
|
|
||||||
|
|
||||||
# Highlighters & Completion
|
|
||||||
|
|
||||||
add-highlighter shared/inf regions
|
|
||||||
add-highlighter shared/inf/code default-region group
|
|
||||||
add-highlighter shared/inf/comment region (^|\h)\K# $ fill comment
|
|
||||||
add-highlighter shared/inf/double_string region -recurse %{(?<!")("")+(?!")} %{(^|\h)\K"} %{"(?!")} group
|
|
||||||
|
|
||||||
evaluate-commands %sh{
|
|
||||||
# Grammar
|
|
||||||
keywords="case let in match of def datatype alias typecheck"
|
|
||||||
types="int bool string list"
|
|
||||||
values="true false"
|
|
||||||
|
|
||||||
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
|
||||||
printf %s\\n "declare-option str-list kak_static_words $(join "${keywords} ${attributes} ${types} ${values}" ' ')'"
|
|
||||||
|
|
||||||
# Highlight keywords (which are always surrounded by whitespace)
|
|
||||||
printf '%s\n' "add-highlighter shared/inf/code/keywords regex (?:\s|\A)\K($(join "${keywords}" '|'))(?:(?=\s)|\z) 0:keyword
|
|
||||||
add-highlighter shared/inf/code/types regex (?:\s|\A)\K($(join "${types}" '|'))(?:(?=\s)|\z) 0:type
|
|
||||||
add-highlighter shared/inf/code/values regex (?:\s|\A)\K($(join "${values}" '|'))(?:(?=\s)|\z) 0:value"
|
|
||||||
}
|
|
||||||
|
|
||||||
add-highlighter shared/inf/code/numbers regex \b\d+\b 0:value
|
|
||||||
|
|
||||||
add-highlighter shared/inf/double_string/fill fill string
|
|
||||||
add-highlighter shared/inf/double_string/escape regex '""' 0:default+b
|
|
||||||
|
|
||||||
§
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
# Detection
|
||||||
|
hook global BufCreate .*\.(mil) %{
|
||||||
|
set-option buffer filetype milly
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=milly %{
|
||||||
|
require-module milly
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group milly-highlighter global WinSetOption filetype=milly %{
|
||||||
|
add-highlighter window/milly ref milly
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{
|
||||||
|
remove-highlighter window/milly
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module milly %§
|
||||||
|
|
||||||
|
# Highlighters & Completion
|
||||||
|
|
||||||
|
add-highlighter shared/milly regions
|
||||||
|
add-highlighter shared/milly/code default-region group
|
||||||
|
add-highlighter shared/milly/comment region (^|\h)\K# $ fill comment
|
||||||
|
add-highlighter shared/milly/double_string region -recurse %{(?<!")("")+(?!")} %{(^|\h)\K"} %{"(?!")} group
|
||||||
|
|
||||||
|
evaluate-commands %sh{
|
||||||
|
# Grammar
|
||||||
|
keywords="case let in match of def datatype alias typecheck"
|
||||||
|
types="int bool string list"
|
||||||
|
values="true false"
|
||||||
|
|
||||||
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
|
# Add the language's grammar to the static completion list
|
||||||
|
printf %s\\n "declare-option str-list kak_static_words $(join "${keywords} ${attributes} ${types} ${values}" ' ')'"
|
||||||
|
|
||||||
|
# Highlight keywords (which are always surrounded by whitespace)
|
||||||
|
printf '%s\n' "add-highlighter shared/milly/code/keywords regex (?:\s|\A)\K($(join "${keywords}" '|'))(?:(?=\s)|\z) 0:keyword
|
||||||
|
add-highlighter shared/milly/code/types regex (?:\s|\A)\K($(join "${types}" '|'))(?:(?=\s)|\z) 0:type
|
||||||
|
add-highlighter shared/milly/code/values regex (?:\s|\A)\K($(join "${values}" '|'))(?:(?=\s)|\z) 0:value"
|
||||||
|
}
|
||||||
|
|
||||||
|
add-highlighter shared/milly/code/numbers regex \b\d+\b 0:value
|
||||||
|
|
||||||
|
add-highlighter shared/milly/double_string/fill fill string
|
||||||
|
add-highlighter shared/milly/double_string/escape regex '""' 0:default+b
|
||||||
|
|
||||||
|
§
|
||||||
Loading…
Reference in New Issue