Skip to content

Commit

Permalink
Merge pull request #189 from Backlang-Org/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
furesoft authored Dec 1, 2022
2 parents aa92982 + f71f1b6 commit 22d795f
Show file tree
Hide file tree
Showing 152 changed files with 3,222 additions and 1,491 deletions.
2 changes: 1 addition & 1 deletion .Net Core Templates/templatepack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageType>Template</PackageType>
<PackageVersion>1.0.60</PackageVersion>
<PackageVersion>1.0.61</PackageVersion>
<PackageId>Backlang.Templates</PackageId>
<Title>Backlang Templates</Title>
<Authors>furesoft</Authors>
Expand Down
4 changes: 1 addition & 3 deletions .Net Core Templates/templates/console/Program.back
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
public static func main() -> i32
func main()
{
print("Hello World");

return 0;
}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- kind: macOS
os: macos-latest
target: osx-x64

runs-on: ${{ matrix.os }} # For a list of available runner types, refer to https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Tests

on:
push:
branches:
branches:
- '*' # matches every branch that doesn't contain a '/'
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
pull_request:
branches:
branches:
- '*' # matches every branch that doesn't contain a '/'
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
Expand All @@ -19,7 +19,7 @@ jobs:
env:
Solution_Name: Source/Backlang-Compiler.sln # Replace with your solution name, i.e. MyWpfApp.sln.
Test_Project_Path: Source/TestProject1/TestProject1.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -31,7 +31,10 @@ jobs:
with:
dotnet-version: 7.0.x
include-prerelease: true


- name: Install WASM
run: dotnet workload install wasm-tools

- name: Build
run: dotnet build $Solution_Name --configuration Release

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,4 @@ MigrationBackup/
.ionide/

*.vsix
StreamPlan.txt
*.dll
14 changes: 5 additions & 9 deletions Source/.vscode/launch.json → .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Backlang-Compiler/bin/Debug/net7.0/Backlang-Compiler.dll",
"args": ["-i", "${workspaceFolder}/Backlang-Compiler/bin/Debug/net7.0/compilation.back", "-o", "compilation"],
"program": "${workspaceFolder}/Source/Backlang-Compiler/bin/Debug/net7.0/Backlang-Compiler.dll",
"args": ["-i", "${workspaceFolder}/Source/Backlang-Compiler/bin/Debug/net7.0/compilation.back", "-o", "compilation"],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
"stopAtEntry": false,
"console": "internalConsole"
}

]
}
3 changes: 3 additions & 0 deletions Source/.vscode/tasks.json → .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"type": "shell",
"args": [
"build",

"Source/",

// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
Expand Down
6 changes: 6 additions & 0 deletions Source/Backlang-Compiler.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backlang.Backends.Bs2k", "P
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backlang.ResourcePreprocessor.Mif", "Plugins\Backlang.ResourcePreprocessor.Mif\Backlang.ResourcePreprocessor.Mif.csproj", "{F45724ED-51E7-4262-A94C-42C1F639E7AE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backlang.WasmBridge", "Backlang.WasmBridge\Backlang.WasmBridge.csproj", "{DFA33B5E-1C8F-4930-9130-24C00D935919}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -71,6 +73,10 @@ Global
{F45724ED-51E7-4262-A94C-42C1F639E7AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F45724ED-51E7-4262-A94C-42C1F639E7AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F45724ED-51E7-4262-A94C-42C1F639E7AE}.Release|Any CPU.Build.0 = Release|Any CPU
{DFA33B5E-1C8F-4930-9130-24C00D935919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DFA33B5E-1C8F-4930-9130-24C00D935919}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFA33B5E-1C8F-4930-9130-24C00D935919}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFA33B5E-1C8F-4930-9130-24C00D935919}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
11 changes: 4 additions & 7 deletions Source/Backlang-Compiler/Backlang-Compiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Flo" Version="0.3.0" />
<PackageReference Include="Furesoft.Core.CodeDom.Backends" Version="1.0.46" />
<PackageReference Include="Furesoft.Core.CodeDom.Compiler" Version="1.0.46" />
<PackageReference Include="System.Composition" Version="6.0.0" />
<PackageReference Include="System.Composition.Hosting" Version="6.0.0" />
<PackageReference Include="Furesoft.Core.CodeDom.Backends" Version="1.0.48" />
<PackageReference Include="Furesoft.Core.CodeDom.Compiler" Version="1.0.48" />
<PackageReference Include="System.Composition" Version="7.0.0" />
<PackageReference Include="System.Composition.Hosting" Version="7.0.0" />
<PackageReference Include="System.Runtime.Experimental" Version="7.0.0-preview.2.22152.2" />
</ItemGroup>

Expand All @@ -29,9 +29,6 @@
<None Update="compilation.back">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="test.back">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

</ItemGroup>

Expand Down
9 changes: 7 additions & 2 deletions Source/Backlang-Compiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ public static class Program
{
public static void Main(string[] args)
{
Parser.Default.ParseArguments<CompilerContext>(args)
.WithParsed(context => {
Parser.Default.ParseArguments<CompilerCliOptions>(args)
.WithParsed(options => {
var context = new CompilerContext
{
Options = options
};

CompilerDriver.Compile(context);
});
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Backlang-Compiler/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Backlang-Compiler": {
"commandName": "Project",
"commandLineArgs": "-i compilation.back -o compilation --target dotnet"
"commandLineArgs": "-i compilation.back -o compilation --target dotnet --framework net7.0"
}
}
}
16 changes: 8 additions & 8 deletions Source/Backlang-Compiler/compilation.back
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import System;

public struct Point
{
let callback: (i32, bool) -> none;
let tuple: (i32, char);
//let a: i32*; // this make a crashy crashy crash
}
func main() {
if true {
return 1;
}
else {
return 2;
}

Main {
print("after");
}
103 changes: 0 additions & 103 deletions Source/Backlang-Compiler/test.back

This file was deleted.

17 changes: 17 additions & 0 deletions Source/Backlang.Codeanalysis/Backlang.Codeanalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@




<ItemGroup>
<None Include="..\..\logo.png">
<Pack>True</Pack>
Expand All @@ -27,8 +28,24 @@

<ItemGroup>
<PackageReference Include="Loyc.Syntax" Version="30.1.0" />
<PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />
<PackageReference Include="System.Runtime.Experimental" Version="7.0.0-preview.2.22152.2" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<Import Project="$(SolutionDir)\Version.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Backlang.Codeanalysis.Core.Attributes;
using Backlang.Codeanalysis.Parsing.Precedences;
using Backlang.Codeanalysis.Parsing.Precedences;

namespace Backlang.Codeanalysis.Core.Attributes;

Expand All @@ -13,5 +12,4 @@ public BinaryOperatorInfoAttribute(int precedence) : base(precedence, isUnary: f
public BinaryOperatorInfoAttribute(BinaryOpPrecedences precedence) : this((int)precedence)
{
}

}
}
2 changes: 1 addition & 1 deletion Source/Backlang.Codeanalysis/Core/BaseLexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void ReportError()
_column++;

var range = SourceRange.New(_document, new IndexRange(_position, 1));
Messages.Add(Message.Error($"Unknown Charakter '{Current()}'", range));
Messages.Add(Message.Error(new LocalizableString(ErrorID.UnknownCharacter, Current().ToString()), range));
Advance();
}
}
37 changes: 37 additions & 0 deletions Source/Backlang.Codeanalysis/Core/ErrorID.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace Backlang.Codeanalysis.Core;

public enum ErrorID : int
{
UnexpecedType = 0001,
InvalidModifierCombination = 0002,
UnknownCharacter = 0003,
UnterminatedCharLiteral = 0004,
UnknownExpression = 0005,
UnknownLiteral = 0006,
ForbiddenTrailingComma = 0007,
BitfieldNotLiteral = 0008,
UnexpecedTypeMember = 0009,
ExpectedTypeLiteral = 0010,
UnknownSwitchOption = 0011,
NoCatchBlock = 0012,
EmptyFile = 0013,
ExpectedIdentifier = 0014,
UnterminatedStringLiteral = 0015,
NotClosedMultilineComment = 0016,
Expected = 0017,
DuplicateModifier = 0018,
NamespaceAlreadyImported = 0019,
RunnableTypeButNoEntrypoint = 0020,
CannotBeFoundDidYouMean = 0021,
CannotImplementTypeNotFound = 0022,
CannotImplementUnitType = 0023,
AlreadyDeclared = 0024,
TypeMismatch = 0025,
UnitTypeMismatch = 0026,
CannotBeResolved = 0027,
CannotFindFunction = 0028,
TargetNotFound = 0029,
NotDefined = 0030,
CannotDeduceType = 31,
DeducingTypeNotPossible = 32,
}
Loading

0 comments on commit 22d795f

Please sign in to comment.