Skip to content

Commit

Permalink
Merge pull request #128 from Stepami/master
Browse files Browse the repository at this point in the history
release v2.1.0 +semver:skip
  • Loading branch information
Stepami authored Feb 2, 2025
2 parents 6496893 + 6e4fb12 commit a49c138
Show file tree
Hide file tree
Showing 108 changed files with 868 additions and 708 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Setup GitVersion
uses: gittools/actions/gitversion/setup@v3.0.0
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
config:
- os: ubuntu-latest
rid: linux-x64
- os: macos-12
- os: macos-latest-large
rid: osx-x64
- os: macos-14
- os: macos-latest
rid: osx-arm64
- os: windows-latest
rid: win-x64
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Setup GitReleaseManager
uses: gittools/actions/gitreleasemanager/setup@v3.0.0
with:
Expand Down
14 changes: 14 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
</PropertyGroup>

</Project>
17 changes: 17 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Scrutor" Version="4.2.2" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
<PackageVersion Include="System.IO.Abstractions" Version="21.0.29" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="Visitor.NET" Version="4.1.2" />
<PackageVersion Include="Visitor.NET.AutoVisitableGen" Version="1.3.0" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions ExtendedJavaScriptSubset.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
SECURITY.md = SECURITY.md
hydrascript-logo.jpg = hydrascript-logo.jpg
GitVersion.yml = GitVersion.yml
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GithubFolder", "GithubFolder", "{54CBE5A7-3C3E-44ED-B877-7B08A818083B}"
Expand Down Expand Up @@ -63,11 +65,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{04AB
samples\typeresolving.js = samples\typeresolving.js
samples\vec2d.js = samples\vec2d.js
samples\cycled.js = samples\cycled.js
samples\scope.js = samples\scope.js
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{FB8F6EE1-1942-46D6-954E-9A1647BBDF10}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3F131901-A9EC-451A-B7E9-726887CFE5FB}"
ProjectSection(SolutionItems) = preProject
tests\Directory.Build.props = tests\Directory.Build.props
tests\Directory.Packages.props = tests\Directory.Packages.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{A280C99E-0112-4F3C-A5E9-B793F2D9898E}"
EndProject
Expand Down
2 changes: 2 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mode: Mainline
branches:
release:
tag: ''
regex: ^release$
increment: None
ignore:
sha: []
Expand Down
28 changes: 9 additions & 19 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@

![logo](hydrascript-logo.jpg)

![Code Coverage](https://img.shields.io/badge/Code%20Coverage-47%25-critical?style=flat)

| Package | Line Rate | Health |
|----------------------------------------|-----------------------|--------|
| HydraScript.Domain.BackEnd | 81% ||
| HydraScript.Infrastructure | 70% ||
| HydraScript.Domain.FrontEnd | 57% ||
| HydraScript.Domain.IR | 74% ||
| HydraScript.Application.CodeGeneration | 0% ||
| HydraScript.Application.StaticAnalysis | 4% ||
| **Summary** | **47%** (1325 / 2792) ||

_Minimum allowed line rate is `80%`_

## "Расширенное подмножество ЯП JavaScript"

### Вводная информация
Expand Down Expand Up @@ -182,12 +168,16 @@ let l = array[2]
```
let s = v2d as string
```
#### Стандартная библиотека
- Функция `print` c сигнатурой `(string) => void`; осуществляет печать строки на экран
#### Печать на экран
```
let obj = {}
>>>obj
>>>"Hello, World!"
```

### Требования

- .NET 8 SDK
- .NET 9 SDK

### Сборка
После клонирования репозитория идём в папку проекта `HydraScript`.
Expand All @@ -211,10 +201,10 @@ HydraScript file.js --dump

### Источники:

1. Курсы "Конструирование Компиляторов" и "Генерация Оптимального Кода" кафедры ИУ-9 МГТУ им. Н.Э. Баумана
1. Курсы "Конструирование Компиляторов" и "Генерация Оптимального Кода" кафедры ИУ-9 МГТУ им. Н.Э. Баумана [@bmstu-iu9](https://www.github.com/bmstu-iu9)
2. [ECMA-262](https://www.ecma-international.org/publications-and-standards/standards/ecma-262/)
3. [DragonBook](https://suif.stanford.edu/dragonbook/)
4. [Stanford CS143 Lectures](https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/)
5. [Simple Virtual Machine](https://github.com/parrt/simple-virtual-machine)
6. Ахо А., Ульман Дж. Теория синтаксического анализа, перевода и компиляции
7. Свердлов С.З. Языки программирования и методы трансляции
7. Свердлов С.З. Языки программирования и методы трансляции
3 changes: 1 addition & 2 deletions samples/abs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ function abs(x: number): number {
}

let x = -10
let a = abs(x)
print(a as string)
>>> abs(x)
2 changes: 1 addition & 1 deletion samples/arraddremove.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
let arr = [3,3,2,1,] ++ [4,5,]
arr::0
print(arr as string)
>>>arr
2 changes: 1 addition & 1 deletion samples/arreditread.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ let arr = [1,2,1,]
let item = arr[0]
item = item + 2
arr[0] = item
print(arr as string)
>>>arr
3 changes: 1 addition & 2 deletions samples/ceil.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ function ceil(x: number): number {
return x + (1 - x % 1)
}

let c = ceil(3.3)
print(c as string)
>>> ceil(3.3)
2 changes: 1 addition & 1 deletion samples/cycled.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ let obj: CycledType = {
x: null;
}
obj.x = obj
print(obj as string)
>>>obj
2 changes: 1 addition & 1 deletion samples/defaultarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ type numbers = number[]

let a: numbers

print(a as string)
>>>a
3 changes: 1 addition & 2 deletions samples/equals.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ let obj2: withEquals = {
prop: 2;
}

let res = obj1.equals(obj2)
print(res as string)
>>> obj1.equals(obj2)
2 changes: 1 addition & 1 deletion samples/exprtest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
let a = 1 + 3 * 2 - 5 / 5
// a == 6
print(a as string)
>>>a
4 changes: 1 addition & 3 deletions samples/fastpow.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ function fastPow(base: number, power: number): number {
return multiplier * multiplier * base
}

let p = fastPow(13, 3)

print(p as string)
>>> fastPow(13, 3)
2 changes: 1 addition & 1 deletion samples/forwardref.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ let a: A = {
};
}

print(a as string)
>>>a
4 changes: 1 addition & 3 deletions samples/gcd.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ function gcd(a: number, b: number): number {
return gcd(bb, aa % bb)
}

let g = gcd(1280, 720)

print(g as string)
>>> gcd(1280, 720)
3 changes: 1 addition & 2 deletions samples/lcm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ function lcm(a: number, b: number): number {
return (abs(a * b)) / (gcd(a, b))
}

let l = lcm(1280, 720)
print(l as string)
>>> lcm(1280, 720)
7 changes: 3 additions & 4 deletions samples/linkedlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function append(lst: list, item: number) {

function getOdd(lst: list): number[] {
let result: number[]
let n = lst.head
let n: node = lst.head
while (n != null) {
if (n.data % 2 != 0) {
let i = n.data
Expand All @@ -42,7 +42,6 @@ linkedList.append(3)
linkedList.append(5)
linkedList.append(7)

print(linkedList as string)
>>>linkedList

let odds = linkedList.getOdd()
print(odds as string)
>>> linkedList.getOdd()
2 changes: 1 addition & 1 deletion samples/objeditread.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ let obj2 = {
}

obj2.k = obj1.p.s.v
print(obj2 as string)
>>>obj2
6 changes: 3 additions & 3 deletions samples/posneg.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ function negative(x: number): boolean {

let x = 0
if (positive(x)) {
print("positive")
>>>"positive"
} else if (negative(x)) {
print("negative")
>>>"negative"
} else {
print("zero")
>>>"zero"
}
4 changes: 1 addition & 3 deletions samples/prime.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ function prime(x: number): boolean {
return true
}

let b = prime(13)

print(b as string)
>>> prime(13)
4 changes: 2 additions & 2 deletions samples/primefactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ let factor = 2
while (factor * factor <= n) {
while (n % factor == 0) {
n = n / factor
print(factor as string)
>>>factor
}

factor = factor + 1
}

if (n != 1) {
print(factor as string)
>>>factor
}
2 changes: 1 addition & 1 deletion samples/quicksort.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ function quickSort(values: ints) {

let numbers = [6,2,4,3,7,1,5,]
quickSort(numbers)
print(numbers as string)
>>>numbers
3 changes: 1 addition & 2 deletions samples/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ function range(n: int): ints {
return r
}

let r1to6 = range(6)
print(r1to6 as string)
>>> range(6)
4 changes: 2 additions & 2 deletions samples/recur.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ let n: number
n = 6
let fa6 = fact(6)
let fa6s = fa6 as string
print("fact(6) = " + fa6s)
>>> "fact(6) = " + fa6s

n = 9
let fi9 = fib(9)
let fi9s = fi9 as string
print("fib(9) = " + fi9s)
>>> "fib(9) = " + fi9s
10 changes: 10 additions & 0 deletions samples/scope.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type Obj = {
x: number;
}

let x: Obj
x = {
x: 1;
}

>>>x.x
6 changes: 3 additions & 3 deletions samples/searchinll.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function searchEven(n: node): number {
let h = n
while (h != null) {
let d = h.data
print(d as string)
>>>d
if (d % 2 == 0) {
return d
}
Expand All @@ -36,5 +36,5 @@ function searchEven(n: node): number {
}

let j = searchEven(head)
print("found Even:")
print(j as string)
>>>"found Even:"
>>>j
Loading

0 comments on commit a49c138

Please sign in to comment.