Commit graph

6506 commits

Author SHA1 Message Date
dd67b9f97b Library: cover some definition errors 2024-03-25 00:38:35 +01:00
8d432a6e0b Library: connect both parts of the engine
...gets the hello-world test to run
2024-03-25 00:37:58 +01:00
20f2b1b90a Library: complete implementation of code generation
...including the handling of cross jumps / links
...verified by one elaborate example in the tests
2024-03-24 21:42:38 +01:00
fd1ce5f0c1 Library: add special treatment for std::string_view
Sting-view is tricky, since it deliberately does not define a
conversion operator; rather, string has an explicit constructor.
This design was chosen on purpose, since creating a string will
„materialise“ the string-view, which could have severe performance
ramifications when done automatically.

Regarding Lumiera's string-conversion tooling, it seems indicated
thus to add std::string_view explicitly as a known conversion path,
even while this conversion does not happen implicitly.
2024-03-24 21:36:18 +01:00
aab446ce48 Library: further straighten iteration logic
playing the »fence post problem« the other way round
and abandoning the ''pull processing'' in favour of direct manipulation
leads to much clearer formulation of the code-generation logic
2024-03-24 15:51:38 +01:00
bc8e947f3c Library: remould compiler to active iteration
...turns out the ''pipeline design'' is not a good fit for the
Action compilation, since the compiler needs to refer to previous Actions;
better to let the compiler ''build'' the `ActionSeq`
2024-03-24 14:21:44 +01:00
b835d6a012 Library: get the template compiler basically operative
...implementation of bracketed constructs and cross references still omitted

...define a fairly elaborate test example for parsing
2024-03-24 00:48:04 +01:00
a9cbe7eb90 Library: define skeleton of TextTemplate compilation
...implemented as »custom processing layer« within a
demand-driven parsing pipeline, with the ability to
inject additional Action-tokens to represent the intermittent
constant text between tags; special handling to expose one
constant postfix after the last active tag.
2024-03-23 19:38:53 +01:00
5b53b53c4c Library: solution for ''trailing prefix'' in parser-context
* use a string-view embedded into the context-λ
 * on each match clip off some starting prefix from this string-view
2024-03-23 02:55:28 +01:00
c2df391f48 Library: draft how a pipelined-parser could work 2024-03-23 02:55:28 +01:00
2a60f77bdf Library: improve formulation of the parsing regexp
- allow additional leading and trailing whitespace within token
- more precise on the sequence of keywords
- clearer build-up of the regexp syntax
2024-03-23 02:55:28 +01:00
10bda3a400 Library: develop a token-parsing regular expression
oh my!
2024-03-23 02:55:28 +01:00
9790feb822 Library: remould MatchSeq into a _Lumiera Forward Iterator_
MatchSeq was imported recently from the Yoshimi-testsuite,
as supporting helper for the CSV table component.

Actually this is just a thin wrapper on top of std::regex_iterator,
which in turn has properties and behaviour very similar to Lumiera's
»Forward Iterator« concept (in fact, it was a source of inspiration to
generalise such a pattern).

So this is an obvious round out and cleanup, as it requires just some
minor additions and adjustments to allow processing a sequence of matches
through a for-loop or some elaborate pipelining setup.
2024-03-23 02:55:28 +01:00
a2749adbc9 Library: also cover the smart-ptr usage variant
The way I've written this helper template, as a byproduct
it is also possible to maintain the back-refrence to the container
through a smart-ptr. In this case, the iterator-handle also manages
the ownership automatically.
2024-03-21 19:57:34 +01:00
f716fb0bee Library: build a helper to encapsulate container access by index
...mostly we want the usual convenient handling pattern for iterators,
but with the proviso actually to perform an access by subscript,
and the ability to re-set to another current index
2024-03-21 19:57:34 +01:00
76bd9ba6ce Library: establish evaluation and iteration on application 2024-03-21 19:57:34 +01:00
7893cc99c3 Library: further work out the framework for TextTemplate instantiation 2024-03-21 19:57:34 +01:00
d2dcf6c163 Library: draft the interpretation of a compiled TextTemplate
will use an iteration-pipeline, based on the »State Core« concept
2024-03-21 19:57:34 +01:00
5881b014fe Library: work out a treatment for text template substitution (see: #1359)
* establish the feature set to provide
 * choose scheme for runtime representation
 * break down analysis to individual parsing and execution steps
 * conclude which actions to conduct and the necessary data
 * derive the abstract binding API required
2024-03-21 19:57:34 +01:00
af1f549190 Library: Assessment and plan for a text templating engine
Conducted an extended investigation regarding text templating
and the library solutions available and still maintained today.

The conclusion is
 * there are some mature and widely used solutions available for C++
 * all of these are considered a mismatch for the task at hand,
   which is to generate Gnuplot scripts for test data visualisation

Points of contention
 * all solutions offer a massive feature set, oriented towards web content generation
 * all solutions provide their own structured data type or custom property-tree framework

**Decision** 🠲  better to write a minimalistic templating engine from scratch rather
2024-03-21 19:57:34 +01:00
d3fda114f8 Library: Research -- Gnuplot
Read the documentation and find out how to generate the kind of diagram
necessary for visualisation of Scheduler-Stress-Test observations.

I used to have basic Gnuplot knowledge, and thus had to find out about
- reading CSV
- supported diagram types
- layering and styling

Conclusion: will use Gnuplot and generate a script from Test code
2024-03-21 19:57:34 +01:00
a90b9e5f16 Library: uniform definition scheme for error-IDs
In the Lumiera code base, we use C-String constants as unique error-IDs.
Basically this allows to create new unique error IDs anywhere in the code.

However, definition of such IDs in arbitrary namespaces tends to create
slight confusion and ambiguities, while maintaining the proper use statements
requires some manual work.

Thus I introduce a new **standard scheme**
 * Error-IDs for widespread use shall be defined _exclusively_ into `namespace lumiera::error`
 * The shorthand-Macro `LERR_()` can now be used to simplify inclusion and referral
 * (for local or single-usage errors, a local or even hidden definition is OK)
2024-03-21 19:57:34 +01:00
59390cd2f8 Library: reorder some pervasively used includes
reduce footprint of lib/util.hpp
 (Note: it is not possible to forward-declare std::string here)

define the shorthand "cStr()" in lib/symbol.hpp

reorder relevant includes to ensure std::hash is "hijacked" first
2024-03-21 19:57:34 +01:00
aa93bf9285 Library: cover statistic functions and linear regression 2024-03-16 03:05:49 +01:00
1f5518e2c8 Library: introduce functions for floating-point comparisons
- rough numeric comparisons (optionally given precision)
- epsilon comparison based on numeric_limits
2024-03-16 03:03:29 +01:00
95198c5f2a Library: need to exclude C++ stream sources from string conversion
In the Lumiera code base, a convenient string conversion is used
an many places, and is also ''magically'' integrated into the usual
C++ style output with `<<` operators.

However, there is a ''gotcha'' — in the ''rare cases'' when we
actually want to use the C++ input/output framework to copy stream
data from an input source into an output sink, obviously we do not want
the input source to be »string converted«....
2024-03-15 02:47:46 +01:00
599407deea Library: complete coverage of CSV data table including storage
also encompasses some coverage for the simplistic CSV format
implemented as storage backend for this data table
2024-03-15 02:45:45 +01:00
3b3600379a Library: introduce formating variants for decimal10
showDecimal -> decimal10 (maximal precision to survive round-trip through decimal representation=

showComplete -> max_decimal10 (enough decimal places to capture each possible distinct floating-point value)


Use these new functions to rewrite the format4csv() helper
2024-03-14 17:32:22 +01:00
01a098db99 Library: cover row handling of data table
...this uncovered one inconsistency: when directly adding values
into one of the embedded data vectors, the inconsistent size
was allowed to persist even when adding / removing lines.

This is in contradiction to the behavior for the CSV dump,
which uses index positions from the front of all vectors uniformely.

Thus changed the behaviour of adding a new row, so that it now
caps all vectors to a common size

also added function to clear the table
2024-03-14 17:29:16 +01:00
4a8364e422 Library: extend the DataFile to allow using it without storage
...seems obvious and does not compromise the simplistic design...
...we do check the file path anyway, just need to add saveAs()...
2024-03-13 18:57:48 +01:00
1c2cbd4d47 Library: coverage for some filesystem convenience helpers
...created as a byproduct of the TempDir feature,
which in turn is required to do ''any'' meaningful unit-test
of filesystem related functionality.
2024-03-13 03:52:35 +01:00
a6aad5261c Library: complete and verify temp-dir helper
verify also that clean-up happens in case of exceptions thrown;
as an aside, add Macro to check for ''any'' exception and match
on something in the message (as opposed to just a Lumiera Exception)
2024-03-13 02:50:13 +01:00
18b1d37a3d Library: also create unique temporary files
...using the same method for sake of uniformity

Also move the permissions helpers to the file.hpp support functions
and setup a separate unit test for these
2024-03-12 22:54:05 +01:00
a1832b1cb9 Library: base implementation of temp-dir creation
Inspired by https://stackoverflow.com/a/58454949

Verified behaviour of fs::create_directory
 --> it returns true only if it ''indeed could create'' a new directory
 --> it returns false if the directory exists already
 --> it throws when some other obstacle shows up

As an aside: the Header include/limits.h could be cleaned up,
and it is used solely from C++ code, thus could be typed, namespaced etc.
2024-03-12 20:14:29 +01:00
b426ea4921 Library: simple default implementation for random sequences
Since this is a much more complicated topic,
for now I decided to establish two instances through global variables:
 * a sequence seeded with a fixed starting value
 * another sequence seeded from a true entropy source

What we actually need however is some kind of execution framework
to define points of random-seeding and to capture seed values for
reproducible tests.
2024-03-12 02:34:19 +01:00
7a3e4098c8 Library: some first thoughts regarding random number generation
Relying on random numbers for verification and measurements is known to be problematic.
At some point we are bound to control the seed values -- and in the actual
application usage we want to record sequence seeding in the event log.

Some initial thoughts regarding this intricate topic.
 * a low-ceremony drop-in replacement for rand() is required
 * we want the ability to pick-up and control each and every usage eventually
 * however, some usages explicitly require true randomness
 * the ability to use separate streams of random-number generation is desirable
2024-03-12 00:48:11 +01:00
6e8c07ccd6 Library: draft tests to document the new features
Yesterday I decided to include some facilities I have written in 2022
for the Yoshimi-Testsuite. The intention is to use these as-is, and just
to adapt them stylistically to the Lumiera code base.

However — at least some basic documentation in the form of
very basic unit-tests can be considered »acceptance criteria«
2024-03-11 17:44:19 +01:00
0e88dec28a Library: integrate into the Lumiera code base
- reformat in Lumieara-GNU style
- use the Lumiera exceptions
- use Lumiera format-string frontend
- use lib/util

NOTE: I am the original author of the code introduced here,
and thus I can re-license it under GPL 2+
2024-03-11 17:38:30 +01:00
8c344b6a51 Library: bring in statistics helper from Yoshimi-test
[http://yoshimi.sourceforge.net/ Yoshimi] is a software sound synthesizer,
derived from `ZynAddSubFx` and developed by an OpenSource community.
The Repository [https://github.com/Ichthyostega/yoshimi-test/ Yoshimi-test]
is used by the Yoshimi developers to maintain a suite of automated
acceptance tests for the Yoshimi application.

This task involves watching execution times to detect long-term performance trends,
which in turn requires to maintain time-series data in CSV files and to perfrom some
simple statistic calculations, including linear regression. Requiring any external
statistics package as dependency was not deemed adequate for such a simple task,
and thus a set of self-contained helper functions was created as a byproduct.

This task attaches an excerpt of the Yoshimi-test history with those helpers.
2024-03-10 23:20:58 +01:00
fda24faa73 add a rounding helper
...as part of:
Breaking Change: adapt runtime.csv storage to improve readability
2024-03-10 23:36:38 +01:00
ef91088fb7 Documentation clean-up and fixes
more clean-up and polishing
after some further test regarding the topic of timing measurements

Improved handling: filter test cases to be performed
2024-03-10 23:36:38 +01:00
48d74f261f heuristics to establish a tolerance band for watching global trends
After the individual tests, we calculate the averaged delta over the
whole test suite, to detect changes to the overall timings. As it turned out,
using the error propagation for the calculation of the averaged delta
yields the right tolerance band to ignore random fluctuations but
trigger alarm on real changes.

Moreover, add several further timing test cases
to verify the calibration via "platform model" works as intended
2024-03-10 23:36:38 +01:00
f2adfc6406 calculate statistics and trend for the complete testsuite 2024-03-10 23:36:38 +01:00
e9eae205f0 use regression to monitor short term and long term trends
Since the platform calibration inevitably incurs some additional error band,
a linear regresssion over the time series of measurements can additionally be used
to spot ongoing systematic changes below this general error band, while
leveling out local statistical fluctuations.
2024-03-10 23:36:38 +01:00
8f9e54b7c7 implement fitting the platform model by linear regression
* triggered by --calibrate
 * normalise away any known expense factors, but use them as weight
 * calculate simple linear regression from statistic data
2024-03-10 23:36:38 +01:00
015a6ed6f2 add global storage and apply existing platform model
...this is largely just wiring of components built thus far

...TODO build platform model by linear regression
2024-03-10 23:36:38 +01:00
75767a3a97 capture and store individual timings as time series
Note: work-in-progress...
TODO: derive the expense factor and delta
2024-03-10 23:36:38 +01:00
7639ac4172 complete implementation of CSV backed data table
...mostly routine after solving the tricky design challenge

- for usage, instantiate the template DataFile with a Storage record
- object is created with filename, and immediately slurps in existing data
- data storage is optimised for readability (not speed); newest value at top

Note: some kind of testcase is "hidden" in this changeset only;
next changeset will remove research-experiment.hpp
2024-03-10 23:36:38 +01:00
a42de3ee1b integrate CSV handling into the new data table type 2024-03-10 23:36:38 +01:00
b6a2eec94c parse a simplified variant of CSV
rationale: the purpose is to read back our own values,
yet it should be reasonably standard, to allow investigating
and tweaking values with a spreadsheet

 - first line is a header line and used to verify the number of columns
 - one record per line, embedded line breaks prohibited
 - fields separated by comma, semicolon tolerated
 - fields are trimmed and may be empty
 - a field may be double quoted
 - only quoted fields may contain whitespace or comma
 - no escaping of quotes, i.e. no quotes within quotes
2024-03-10 23:36:38 +01:00