Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
a908a79
.
b3b00 Apr 28, 2025
0ee6469
.
b3b00 Apr 28, 2025
a2e71cd
.
b3b00 Apr 28, 2025
9c38a2a
.
b3b00 Apr 28, 2025
858486d
wip : working state is not too far
b3b00 Apr 29, 2025
4c7fee0
.
b3b00 Apr 29, 2025
c0289cc
.
b3b00 Apr 29, 2025
a11afb7
.
b3b00 Apr 29, 2025
ec928a6
.
b3b00 Apr 29, 2025
b1ddc30
unit tests
b3b00 Apr 29, 2025
502ad71
Update StackParserTests.cs
b3b00 Apr 29, 2025
56b1fd0
fix expression parsing (position was not sent upward)
b3b00 Apr 30, 2025
a7afaa1
.
b3b00 Apr 30, 2025
ce255f1
debugging
b3b00 Apr 30, 2025
629cdcf
.
b3b00 Apr 30, 2025
95c7948
wip
b3b00 May 1, 2025
a6cbd6e
.
b3b00 May 1, 2025
809c7b2
.
b3b00 May 1, 2025
fe4eb5d
.
b3b00 May 1, 2025
5dba1ad
fix
b3b00 May 1, 2025
1241dc0
wip
b3b00 May 2, 2025
cda5da8
.
b3b00 May 2, 2025
6eaf8b4
.
b3b00 May 2, 2025
5c234b4
fix 1 unit test
b3b00 May 4, 2025
b91c675
.
b3b00 May 4, 2025
d97286f
Update StackDescentSyntaxParser.cs
b3b00 May 4, 2025
d4f2511
fixes
b3b00 May 5, 2025
071e79d
.
b3b00 May 5, 2025
2386511
fix issue 239
b3b00 May 5, 2025
2ea5bc1
.
b3b00 May 5, 2025
696accd
bench stack parser : really impressive
b3b00 May 6, 2025
f0f4ac0
benchmark
b3b00 May 6, 2025
b1d923c
last fix for EBNF rule parser !?
b3b00 May 7, 2025
14624f8
fix sonar issue
b3b00 May 7, 2025
49d00e0
sonar linting
b3b00 May 7, 2025
2bb9dc2
undo fix that degrades perf
b3b00 May 7, 2025
269bf50
another unit test fix : still perf drop
b3b00 May 8, 2025
373adb4
.
b3b00 May 9, 2025
26804aa
Merge pull request #564 from b3b00/exp/unit-test-fix-vs-perf
b3b00 May 9, 2025
a7b2002
cleaning
b3b00 May 9, 2025
f95a541
cleaning
b3b00 May 9, 2025
762b134
xunit runner vs bump 3.0.2 -> 3.1.0
b3b00 May 9, 2025
215805c
fix while tests paralellism
b3b00 May 9, 2025
c651844
.
b3b00 May 9, 2025
0693e9b
.
b3b00 May 9, 2025
7f429e0
Merge branches 'dev' and 'experiment/stack-based-parser' of https://g…
codesandbot May 9, 2025
7018ac6
.
b3b00 May 9, 2025
66ab64f
.
b3b00 May 9, 2025
5a0172a
Merge branch 'dev' into experiment/stack-based-parser
b3b00 May 9, 2025
1eb939e
simplify build workflow
b3b00 May 9, 2025
bb9251c
use stack parser for EBNF parser
b3b00 May 9, 2025
0d6f1b7
ebnf stack : initial
b3b00 May 9, 2025
58fd3f2
wip
b3b00 May 10, 2025
7dd88ac
wip
b3b00 May 11, 2025
9781d7f
wip
b3b00 May 11, 2025
d343d02
fix test
b3b00 May 11, 2025
31ee9bd
wip
b3b00 May 11, 2025
6a07eca
wip one or more
b3b00 May 11, 2025
f16a4ba
.
b3b00 May 11, 2025
f635f75
one or more ok
b3b00 May 12, 2025
3714e22
option : initial
b3b00 May 12, 2025
e894055
ebnf stack : choices
b3b00 May 13, 2025
0213884
ebnf stack : groups wip
b3b00 May 13, 2025
48bbac2
ebnf stack : choices and options
b3b00 May 13, 2025
e9bfabe
ebnf stack tests
b3b00 May 13, 2025
34d1b64
stack ebnf : fixing unit tests
b3b00 May 14, 2025
24b4763
ebnf stack : fix discarded terminal choice
b3b00 May 14, 2025
3c5c73e
unit tests
b3b00 May 14, 2025
4df4874
.
b3b00 May 14, 2025
169a9e6
fix unit tests
b3b00 May 23, 2025
de07cda
.
b3b00 May 23, 2025
7abe69b
expressions : initial
b3b00 May 24, 2025
3c0c640
wip
b3b00 May 25, 2025
a3b33b3
wip
b3b00 May 25, 2025
0cc1e15
wip
b3b00 May 25, 2025
ce9f0b0
expressions: first working state
b3b00 May 26, 2025
115d253
prefix and postfix unit test : failing
b3b00 May 26, 2025
1a7a493
fix
b3b00 May 26, 2025
88f3d13
unit test
b3b00 May 27, 2025
523e9e3
failing unit test
b3b00 May 27, 2025
b926f81
Merge branch 'dev' into stack/ebnf
b3b00 May 27, 2025
d78144f
ebnf stack bench (expression)
b3b00 May 27, 2025
9bcda75
.
b3b00 May 27, 2025
9f501b0
porilfing : initial, limit isInstanceOf by using enum
b3b00 Jun 1, 2025
6682c1a
fix
b3b00 Jun 1, 2025
9457c17
.
b3b00 Jun 16, 2025
a3a202a
bench ebnf stack
b3b00 Jun 16, 2025
c8da19a
.
b3b00 Jun 17, 2025
3e63de0
better unit test asserts
b3b00 Jun 18, 2025
3602c97
fix 0+ and 1+ EBNF unit tests
b3b00 Jul 28, 2025
93e0006
.
b3b00 Jul 28, 2025
74330f9
Merge branch 'dev' into fix/ebnf
b3b00 Sep 19, 2025
027525f
wip
b3b00 Sep 19, 2025
73f028b
Update dotnetcore.yml
b3b00 Sep 20, 2025
4dd9a4f
Update dotnetcore.yml
b3b00 Sep 20, 2025
ccfab0e
.
b3b00 Sep 21, 2025
2d59e00
.
b3b00 Sep 21, 2025
f33ba51
all is green :)
b3b00 Sep 22, 2025
dcdc27a
Merge branch 'trying-to-fix-and-doing-worst' into fix/ebnf
b3b00 Sep 22, 2025
bfa0bab
cleaning
b3b00 Sep 22, 2025
7f2083f
aggregate expected token
b3b00 Sep 22, 2025
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
22 changes: 14 additions & 8 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- dev
permissions:
pull-requests: write
checks: write
jobs:
build:
env:
Expand All @@ -23,7 +24,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
Expand All @@ -35,7 +36,7 @@ jobs:
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test with dotnet
uses: b3b00/coverlet-action@1.3.5-alpha1
uses: b3b00/coverlet-action@d4de331462c1706fd9f07b4b2a565f256fd95a23
id: 'coverlet'
if: env.RUN_TESTS
with:
Expand All @@ -44,17 +45,22 @@ jobs:
threshold: 80
outputFormat: 'lcov'
excludes: '[program]*,[expressionParser]*,[jsonparser]*,[while]*,[indentedWhile]*,[SimpleExpressionParser]*,[GenericLexerWithCallbacks]*,[indented]*,[postProcessedLexerParser]*,[XML]*,[SimpleTemplate]*,[SlowEOS]*'

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6
if: always()
with:
files: |
**/*.trx
- name: coveralls
uses: coverallsapp/github-action@v1.1.1
if: matrix.os == 'windows-latest' && env.RUN_TESTS
if: matrix.os == 'ubuntu-latest' && env.RUN_TESTS
with:
fail-on-error: false
github-token: ${{secrets.GITHUB_TOKEN }}
path-to-lcov: ${{steps.coverlet.outputs.coverageFile}}
#base-path: ${{github.workspace}}
- name: publish nuget
if: ${{success() && matrix.os == 'windows-latest' && env.PUBLISH_NUGET}}
if: ${{success() && matrix.os == 'ubuntu-latest' && env.PUBLISH_NUGET}}
id: publish_nuget
uses: alirezanet/publish-nuget@v3.0.0
with:
Expand All @@ -64,7 +70,7 @@ jobs:
VERSION_FILE_PATH: ${{env.MAIN_CSPROJ}}
INCLUDE_SYMBOLS: true
- name: Create Release
if: ${{ success() && matrix.os == 'windows-latest' && steps.publish_nuget.outputs.VERSION != '' && steps.publish_nuget.outputs.VERSION != null }}
if: ${{ success() && matrix.os == 'ubuntu-latest' && steps.publish_nuget.outputs.VERSION != '' && steps.publish_nuget.outputs.VERSION != null }}
id: create_release
uses: b3b00/create-release@1.0.7
env:
Expand All @@ -76,7 +82,7 @@ jobs:
prerelease: false
failsOnCreationError: false
- name: Upload Release nuget Asset
if: ${{ success() && matrix.os == 'windows-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }}
if: ${{ success() && matrix.os == 'ubuntu-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }}
id: upload-release-nuget-asset
uses: actions/upload-release-asset@v1
env:
Expand All @@ -87,7 +93,7 @@ jobs:
asset_name: ${{ steps.publish_nuget.outputs.PACKAGE_NAME }}
asset_content_type: application/zip
- name: Upload Release symbols nuget Asset
if: ${{ success() && matrix.os == 'windows-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }}
if: ${{ success() && matrix.os == 'ubuntu-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }}
id: upload-release-nuget-symbols-asset
uses: actions/upload-release-asset@v1
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ BenchmarkDotNet.Artifacts
AotTester/*
*.dtp
*.dtp.state
src/samples/HandMadeExpres*
11 changes: 10 additions & 1 deletion src/benchCurrent/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using BenchmarkDotNet.Running;
using sly.parser.generator;

namespace benchCurrent
{
Expand All @@ -15,7 +16,15 @@ private static void Bench() {
// var summary3 = BenchmarkRunner.Run<WhileBench>();

//var summary4 = BenchmarkRunner.Run<SimpleExpressionBench>();
var summary5 = BenchmarkRunner.Run<JsonStringEscapingBench>();

// StackExpressionBench bench = new StackExpressionBench();
// bench.parserType = ParserType.LL_RECURSIVE_DESCENT;
// bench.Setup();
// bench.BenchLargeExpression();

//var summary5 = BenchmarkRunner.Run<StackExpressionBench>();

var summary6 = BenchmarkRunner.Run<StackEbnfExpressionBench>();

}
static void Main(string[] args)
Expand Down
91 changes: 91 additions & 0 deletions src/benchCurrent/StackEbnfExpressionBench.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Toolchains.CsProj;
using simpleExpressionParser;
using sly.parser.generator;


namespace benchCurrent
{

[MemoryDiagnoser]

[Config(typeof(Config))]
//[Config(typeof(ConfigWithPercentage))]
public class StackEbnfExpressionBench
{


private class Config : ManualConfig
{
public Config()
{
SummaryStyle = BenchmarkDotNet.Reports.SummaryStyle.Default.WithRatioStyle(RatioStyle.Trend);
var baseJob = Job.MediumRun.With(CsProjCoreToolchain.NetCoreApp80);
}
}

private string expression = "";

[GlobalSetup]
public void Setup()
{
expression = GetExpression(1000);
}

//[Params(ParserType.LL_RECURSIVE_DESCENT,ParserType.LL_STACK )]
//public ParserType parserType { get; set; }

public string GetExpression(int max)
{
var rnd = new Random();
//int width = rnd.Next(100, max);
char[] ops = new[] { '+', '-', '*' };
var getOp = () => ops[rnd.Next(0, ops.Length)];
var expr = rnd.Next(0, 100).ToString();
for (int i = 0; i < max; i++)
{
var op = getOp();
var right = rnd.Next(0, 100);
expr += $"{op} {right}";

}
Console.WriteLine(expr);
return expr;
}


[Benchmark(Baseline = true)]
public void recursive() => BenchLargeExpression(ParserType.EBNF_LL_RECURSIVE_DESCENT);

[Benchmark]
public void stacked() => BenchLargeExpression(ParserType.EBNF_LL_STACK);

public void BenchLargeExpression(ParserType type)
{
var instance = new SimpleExpressionParser();
ParserBuilder<ExpressionToken, double> builder =
new ParserBuilder<ExpressionToken, double>();
var parser = builder.BuildParser(instance, type, "root");
if (!parser.IsOk)
{
foreach (var error in parser.Errors)
{
Console.WriteLine(error.Message);
}
Environment.Exit(1);
}
var r = parser.Result.Parse(expression);
;
}





}

}
93 changes: 93 additions & 0 deletions src/benchCurrent/StackExpressionBench.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Toolchains.CsProj;
using expressionparser;
using simpleExpressionParser;
using sly.parser;
using sly.parser.generator;
using ExpressionToken = simpleExpressionParser.ExpressionToken;

namespace benchCurrent
{

[MemoryDiagnoser]

[Config(typeof(Config))]
//[Config(typeof(ConfigWithPercentage))]
public class StackExpressionBench
{


private class Config : ManualConfig
{
public Config()
{
SummaryStyle = BenchmarkDotNet.Reports.SummaryStyle.Default.WithRatioStyle(RatioStyle.Trend);
var baseJob = Job.MediumRun.With(CsProjCoreToolchain.NetCoreApp80);
}
}

private string expression = "";

[GlobalSetup]
public void Setup()
{
expression = GetExpression(1000);
}

//[Params(ParserType.LL_RECURSIVE_DESCENT,ParserType.LL_STACK )]
//public ParserType parserType { get; set; }

public string GetExpression(int max)
{
var rnd = new Random();
//int width = rnd.Next(100, max);
char[] ops = new[] { '+', '-', '*' };
var getOp = () => ops[rnd.Next(0, ops.Length)];
var expr = rnd.Next(0, 100).ToString();
for (int i = 0; i < max; i++)
{
var op = getOp();
var right = rnd.Next(0, 100);
expr += $"{op} {right}";

}
Console.WriteLine(expr);
return expr;
}


[Benchmark(Baseline = true)]
public void recursive() => BenchLargeExpression(ParserType.LL_RECURSIVE_DESCENT);

[Benchmark]
public void stacked() => BenchLargeExpression(ParserType.LL_STACK);

public void BenchLargeExpression(ParserType type)
{
var instance = new ExpressionParser();
ParserBuilder<expressionparser.ExpressionToken, int> builder =
new ParserBuilder<expressionparser.ExpressionToken, int>();
var parser = builder.BuildParser(instance, type, "expression");
if (!parser.IsOk)
{
foreach (var error in parser.Errors)
{
Console.WriteLine(error.Message);
}
Environment.Exit(1);
}
var r = parser.Result.Parse(expression);
;
}





}

}
Loading
Loading