Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vscode extension #6

Merged
merged 16 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,38 +48,6 @@ jobs:
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: mdbook build

- name: Install Haskell
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-version: 'latest'

- name: Compil
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: |
if ! stack build; then
exit 0
fi

- name: Tests
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: |
if ! stack test --test-arguments "--html book/Tests.html"; then
exit 0
fi

- name: Coverage
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || steps.filter.outputs.workflow == 'true' || github.ref == 'refs/heads/main'
run: |
if ! make tests-coverage; then
exit 0
else
PATH_HTML=$(make tests-coverage-html-path)
cp -r "$PATH_HTML/koaky" book/
cp -r "$PATH_HTML/combined" book/
cp "$PATH_HTML/index.html" book/Coverage.html
fi

- name: Setup Pages
if: github.ref == 'refs/heads/main'
uses: actions/configure-pages@v3
Expand Down
56 changes: 42 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,22 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} "./koaky-exe.exe#koaky-windows.exe"
gh release upload ${{ needs.release-create.outputs.release }} "./lvtc/lvtc-exe.exe#lvtc-windows.exe"
gh release upload ${{ needs.release-create.outputs.release }} "./lvtrun/lvtrun-exe.exe#lvtrun-windows.exe"

- name: Upload To Artifact
- name: Upload To Artifact lvtc
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: koaky.exe
path: ./koaky.exe
name: lvtc-windows.exe
path: ./lvtc/lvtc-exe.exe

- name: Upload To Artifact lvtrun
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: lvtrun-windows.exe
path: ./lvtrun/lvtrun-exe.exe

release-linux:
runs-on: ubuntu-latest
Expand All @@ -89,21 +97,31 @@ jobs:
run: make

- name: Rename
run: mv koaky-exe koaky-linux
run: |
mv lvtc/lvtc-exe lvtc-linux
mv lvtrun/lvtrun-exe lvtrun-linux

- name: Upload To Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} "./koaky-linux"
gh release upload ${{ needs.release-create.outputs.release }} "./lvtc-linux"
gh release upload ${{ needs.release-create.outputs.release }} "./lvtrun-linux"

- name: Upload To Artifact lvtc
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: lvtc-linux
path: ./lvtc-linux

- name: Upload To Artifact
- name: Upload To Artifact lvtrun
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: koaky-linux
path: ./koaky-linux
name: lvtrun-linux
path: ./lvtrun-linux

release-macos:
runs-on: macos-latest
Expand All @@ -126,18 +144,28 @@ jobs:
run: make

- name: Rename
run: mv koaky-exe koaky-macos
run: |
mv lvtc/lvtc-exe lvtc-macos
mv lvtrun/lvtrun-exe lvtrun-macos

- name: Upload To Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} "./koaky-macos"
gh release upload ${{ needs.release-create.outputs.release }} "./lvtc-macos"
gh release upload ${{ needs.release-create.outputs.release }} "./lvtrun-macos"

- name: Upload To Artifact lvtc
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: lvtc-macos
path: ./lvtc-macos

- name: Upload To Artifact
- name: Upload To Artifact lvtrun
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: koaky-macos
path: ./koaky-macos
name: lvtrun-macos
path: ./lvtrun-macos
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Tests
id: failedTest
run: |
if ! stack test &> tests.log; then
if ! make tests &> tests.log; then
echo "failedTest=true" >> $GITHUB_OUTPUT
else
echo "failedTest=false" >> $GITHUB_OUTPUT
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ tags
/koaky-exe
/glados

lvtc-exe
lvtrun-exe

*.log
*.exe

Expand Down
36 changes: 15 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,35 @@
## makefile that stack
##

TARGET = koaky
MARVIN_TARGET = glados
TARGET = leviator

CP = cp
RM = rm -rf

ifeq ($(OS),Windows_NT)
BIN_STACK = $(TARGET)-exe.exe
else
BIN_STACK = $(TARGET)-exe
endif

all: $(TARGET)
LVT_COMPILER = lvtc
LVT_RUNER = lvtrun

$(TARGET):
stack build --copy-bins --local-bin-path .
$(CP) "$(BIN_STACK)" "$(MARVIN_TARGET)"
"$(MAKE)" -C "$(LVT_COMPILER)"
"$(MAKE)" -C "$(LVT_RUNER)"

clean:
stack clean
"$(MAKE)" -C "$(LVT_COMPILER)" clean
"$(MAKE)" -C "$(LVT_RUNER)" clean

fclean: clean
stack purge
$(RM) "$(BIN_STACK)"
$(RM) "$(MARVIN_TARGET)"
"$(MAKE)" -C "$(LVT_COMPILER)" fclean
"$(MAKE)" -C "$(LVT_RUNER)" fclean

re: fclean $(TARGET)

tests:
stack test
"$(MAKE)" -C "$(LVT_COMPILER)" tests
"$(MAKE)" -C "$(LVT_RUNER)" tests

tests-coverage:
stack test --coverage
"$(MAKE)" -C "$(LVT_COMPILER)" tests-coverage
"$(MAKE)" -C "$(LVT_RUNER)" tests-coverage

tests-coverage-html-path:
@stack path --local-hpc-root
@"$(MAKE)" -C "$(LVT_COMPILER)" tests-coverage-html-path
@"$(MAKE)" -C "$(LVT_RUNER)" tests-coverage-html-path

.PHONY: $(TARGET) fclean re clean all
75 changes: 34 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@

## Documentation

-- **Comentary**
- **Comentary**

```c
// This is a comment
```

-- **Variables Declaration**
- **Variables Declaration**

```hs
@Int a = 1;
@String b = "hello";
```

-- **Variables Assignment**
- **Variables Assignment**

```hs
a = 1;
Expand All @@ -33,17 +33,11 @@ b = "hello";
@Bool a = True;
@Bool b = False;
@Int c = 1;
@List[Int] d = [1, 2, 3];
@Char e = 'a';
@String f = "hello";
@List[Char] g = ['a', 'b', 'c'];
@StringView f = "hello";
```

- **Built-in Global Variables**

```c
@List[String] ARGS = ["programfilepath", "arg1", "arg2"];
```
There is a `Void` type that can be used to return nothing.

- **Function Declaration**

Expand All @@ -53,6 +47,11 @@ fn add(a: Int, b: Int) -> Int
// the next line is the `return`
<- a + b;
};

export fn sub(a: Int, b: Int) -> Int
{
<- a - b;
};
```

- **Function Call**
Expand Down Expand Up @@ -80,23 +79,6 @@ fn add(a: Int, b: Int, c: Int) -> Int
};
```

- **Built-in Functions**

```c
// print to stdout
print("hello");
// print to stderr
printErr("hello");
// get a line from stdin
getLine();
// transform a type to a string
str(1);
// get the type of a value in string format
type(a);
// call a function with string
call("add", [1, 2]);
```

- **Generic Functions**

```rust
Expand Down Expand Up @@ -141,17 +123,6 @@ while (i < 10)
};
```

```c
@List[Int] lst = [1, 2, 3];
foreach (a in lst)
{
if (a == 2)
{
break;
};
};
```

- **Imports**

```c
Expand Down Expand Up @@ -185,15 +156,37 @@ a != b
```c
struct Point
{
a: Int,
x: Int,
y: Int,
};
```

- **Structs Initialization**
```
@Point p = {1, 2};
```

- **Structs Access**
```
p:x
```

- **Nested Structs**
```
struct Rect
{
Point size;
Point pos;
};
@Rect r = {{1, 2}, {3, 4}};
r:size:x
```

- **Generic Structs**

```c
struct Rect[A]
{
a: A,
attribute: A,
};
```
Loading
Loading