Skip to content

Commit

Permalink
Refactoring and simplification (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer authored Sep 28, 2023
1 parent be8e903 commit cdc5d8f
Show file tree
Hide file tree
Showing 65 changed files with 1,043 additions and 545 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: v1.21.0
version: v1.21.2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .run/spice.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spice" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="build -O0 -m release ../../media/test-project/test.spice" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="Spice" TARGET_NAME="spice" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="Spice" RUN_TARGET_NAME="spice">
<configuration default="false" name="spice" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="build -O0 -asm ../../media/test-project/test.spice" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="Spice" TARGET_NAME="spice" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="Spice" RUN_TARGET_NAME="spice">
<envs>
<env name="SPICE_STD_DIR" value="$PROJECT_DIR$/std" />
</envs>
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV TERM="xterm-256color"
ENV SPICE_DOCKERIZED=1

RUN apk update && apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main --no-cache \
build-base ncurses-dev libc6-compat gcompat zstd-dev clang lld && rm -rf /var/cache/apk/*
build-base ncurses-dev libc6-compat gcompat zstd-dev gcc clang lld && rm -rf /var/cache/apk/*
RUN ln -sf /usr/lib/libncursesw.so.6 /usr/lib/libtinfo.so.6

COPY std/ /usr/lib/spice/std/
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/language/casts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ destination type.

Casting an int to the short data type:
```spice
short shortVar = (short) 12;
int intVar = 12;
short shortVar = (short) intVar;
```

Example for casting for a function call:
Expand Down
2 changes: 1 addition & 1 deletion src-bootstrap/CliInterface.spice
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public type CliInterface struct {
public bool shouldExecute = false
}

public p CliInterface.createInterface() {
public p CliInterface.create() {
this.cliParser = CliParser("Spice", "Spice programming language");
this.cliParser.setFooter("(c) Marc Auberer 2021-2023");

Expand Down
20 changes: 20 additions & 0 deletions src-bootstrap/CompilerPass.spice
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import "global/GlobalResourceManager";

type ICompilerPass interface {
p changeToScope(Scope*, const ScopeType&);
p changeToScope(const String&, const ScopeType&);
p changeToParentScope(ScopeType);
}

type CompilerPass struct : ICompilerPass {
GlobalResourceManager& globalResourceManager
const CliOptions& cliOptions
SourceFile* sourceFile
Scope* rootScope
unsigned long manIdx = 0
Scope* currentScope
}

p CompilerPass.ctor(GlobalResourceManager& resourceManager, SourceFile* sourceFile) {

}
5 changes: 0 additions & 5 deletions src-bootstrap/analyzer/analyzer.spice

This file was deleted.

14 changes: 14 additions & 0 deletions src-bootstrap/ast/ASTBuilder.spice
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import "../CompilerPass";
import "../SourceFile";
import "SpiceVisitor";

type ASTBuilder struct : ICompilerPass, SpiceVisitor {
CompilerPass compilerPass
const FilePath& filePath
Stack<ASTNode*> parentStack
}

p ASTBuilder.ctor(GlobalResourceManager& resourceManager, SourceFile* sourceFile = nil<SourceFile*>) {
this.compilerPass = CompilerPass(resourceManager, sourceFile);
this.resourceManager = resourceManager;
}
2 changes: 1 addition & 1 deletion src-bootstrap/ast/AbstractAstVisitor.spice
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "std/type/any";

public type AbstractAstVisitor interface {
public type IAbstractAstVisitor interface {
f<Any> visitEntry(EntryNode*);
f<Any> visitMainFctDef(EntryNode*);
f<Any> visitFctDef(EntryNode*);
Expand Down
Loading

0 comments on commit cdc5d8f

Please sign in to comment.