Rename project
This commit is contained in:
parent
2911139d96
commit
a10f3db4fc
|
|
@ -1,4 +1,4 @@
|
|||
# build artifacts
|
||||
build/
|
||||
milly
|
||||
inf
|
||||
reference_parser
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -7,7 +7,7 @@ obj_dir = build
|
|||
object_paths = $(addprefix $(obj_dir)/, $(objects))
|
||||
|
||||
|
||||
milly: $(object_paths)
|
||||
inf: $(object_paths)
|
||||
$(CC) -o $@ $(CFLAGS) $(object_paths)
|
||||
|
||||
$(obj_dir)/%.o: src/%.c include/*.h | $(obj_dir)
|
||||
|
|
@ -26,7 +26,7 @@ $(obj_dir):
|
|||
mkdir -p $(obj_dir)
|
||||
|
||||
clean:
|
||||
rm -f milly
|
||||
rm -f inf
|
||||
rm -f reference_parser
|
||||
rm -r $(obj_dir)
|
||||
|
||||
|
|
|
|||
14
README.md
14
README.md
|
|
@ -1,12 +1,12 @@
|
|||
# milly
|
||||
# inf
|
||||
|
||||
milly is an hobby, and should not be taken seriously.
|
||||
inf 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.
|
||||
|
||||
## How to build
|
||||
|
||||
milly's interpreter is written in portable ISO C11, sources are in `src/` and header files are in `include/`.
|
||||
inf'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:
|
||||
|
||||
|
|
@ -14,11 +14,11 @@ If your system happens to have a `make` implementation compatible with **GNU Mak
|
|||
|
||||
Otherwise, something like this should work:
|
||||
|
||||
> $(CC) -std=c11 -o milly -Iinclude/ src/*.c
|
||||
> $(CC) -std=c11 -o inf -Iinclude/ src/*.c
|
||||
|
||||
## The language
|
||||
|
||||
milly is a minimal dialect of Standard ML and Haskell,
|
||||
inf is a minimal dialect of Standard ML and Haskell,
|
||||
here is a list of the features (or better, limitations) I want to introduce:
|
||||
|
||||
- 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)
|
||||
- Easy syntax allowing easy kakoune support
|
||||
|
||||
milly's full grammar is specified as a pair of lex and yacc files in `ref_parser/`.
|
||||
inf's full grammar is specified as a pair of lex and yacc files in `ref_parser/`.
|
||||
|
||||
kakoune plugin for milly is in `extra/milly.kak`.
|
||||
kakoune plugin for inf is in `extra/inf.kak`.
|
||||
|
||||
Here is a small example of the syntax:
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
# 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
|
||||
|
||||
§
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
# 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
|
||||
|
||||
§
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* milly's Flex grammar */
|
||||
/* inf's Flex grammar */
|
||||
%{
|
||||
#include "parser.tab.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* milly's Bison grammar */
|
||||
/* inf's Bison grammar */
|
||||
%{
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 2) {
|
||||
printf("Usage: milly file.mil\n");
|
||||
printf("Usage: %s file.mil\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
FILE *input = fopen(argv[1], "r");
|
||||
|
|
|
|||
Loading…
Reference in New Issue