Skip to content

Commit

Permalink
This is version 6.0.0-alpha.1.
Browse files Browse the repository at this point in the history
Remove all EGTneo writing functions, excluding toStreamNeo.
  • Loading branch information
teo-tsirpanis committed Apr 13, 2020
1 parent b323824 commit 0b386ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### 6.0.0-alpha.1
#### 6.0.0-alpha.1 - 13-04-2020
* __Breaking change:__ Removed the legacy API for creating runtime Farkles from EGT files (the API with the transformers and fusers). EGT files are still supported (for now), but users are strongly urged to rewrite their grammars using `Farkle.Builder`, or implement the `PostProcessor` interface themselves (not recommended).
* __Breaking change:__ The `PostProcessor` type was moved to the root `Farkle` namespace. Some reusable post-processors were moved to the new `Farkle.PostProcessors` module.
* Farkle can now build grammars at compile-time. See more in https://teo-tsirpanis.github.io/Farkle/the-precompiler.html.
Expand Down
16 changes: 1 addition & 15 deletions src/Farkle/Grammar/EGT.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,4 @@ it as an \"Enhanced Grammar Tables (version 5.0)\"."
let toStreamNeo stream grammar =
use w = new BinaryWriter(stream, Encoding.UTF8, true)
writeNullTerminatedString EGTNeoHeader w
EGTNeoWriter.write w grammar

/// Writes the given `Grammar` to a Base64-encoded
/// string in the EGTneo format and returns it.
[<CompiledName("WriteToBase64StringNeo")>]
let toBase64StringNeo (options: Base64FormattingOptions) grammar =
use s = new MemoryStream()
toStreamNeo s grammar
Convert.ToBase64String(s.ToArray(), options)

/// Writes the given `Grammar` to a file in the EGTneo format.
[<CompiledName("WriteToFileNeo")>]
let toFileNeo path grammar =
use stream = File.OpenWrite path
toStreamNeo stream grammar
EGTNeoWriter.write w grammar
15 changes: 6 additions & 9 deletions tests/Farkle.Benchmarks/GrammarReaderBenchmark.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Farkle.Benchmarks

open BenchmarkDotNet.Attributes
open Farkle
open Farkle.Builder
open Farkle.Common
open Farkle.Grammar
Expand All @@ -16,25 +17,21 @@ type GrammarReaderBenchmark() =

let mutable base64EGT = ""

let mutable base64EGTneo = ""

[<GlobalSetup>]
member __.Setup() =
let bytes = File.ReadAllBytes "gml.egt"
base64EGT <- Convert.ToBase64String bytes

let grammar = EGT.ofBase64String base64EGT
base64EGTneo <- EGT.toBase64StringNeo Base64FormattingOptions.None grammar

[<Benchmark>]
member __.Base64EGT() = EGT.ofBase64String base64EGT

[<Benchmark(Baseline = true)>]
member _.Base64EGTneo() = EGT.ofBase64String base64EGTneo

[<Benchmark>]
member __.BuildGrammar() =
member __.Build() =
GOLDMetaLanguage.designtime
|> DesigntimeFarkleBuild.createGrammarDefinition
|> DesigntimeFarkleBuild.buildGrammarOnly
|> returnOrFail

[<Benchmark>]
member __.BuildPrecompiled() =
RuntimeFarkle.buildUntyped GOLDMetaLanguage.designtime

0 comments on commit 0b386ea

Please sign in to comment.