https://github.com/antononcube/raku-dsl-translators
Raku package for comprehensive multi-DSL translations.
https://github.com/antononcube/raku-dsl-translators
Last synced: over 1 year ago
JSON representation
Raku package for comprehensive multi-DSL translations.
- Host: GitHub
- URL: https://github.com/antononcube/raku-dsl-translators
- Owner: antononcube
- License: artistic-2.0
- Created: 2020-10-06T16:52:14.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-08-09T01:54:30.000Z (almost 2 years ago)
- Last Synced: 2025-02-08T11:13:06.778Z (over 1 year ago)
- Language: Raku
- Size: 265 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-work.md
- License: LICENSE
Awesome Lists containing this project
README
# Comprehensive Translation
[](https://opensource.org/licenses/Artistic-2.0)
This Raku package provides comprehensive multi-DSL translations.
-------
## Installation
To install
`DSL::Translators`
certain DSL Raku modules have to be installed.
See the installation code in the resource file ["zsh-nuke-and-install.sh"](./resources/zsh-nuke-and-install.sh).
(The modules listed above are under development, that is why the installation commands have `--force-test`.)
-------
## Usage
Here we load the package:
```perl6
use DSL::Translators;
```
Here is an example that shows:
- Automatic determination of the DSL grammar
- JSON format of the result
```perl6
ToDSLCode('
use dfStarWars;
select the columns name, species, mass and height;
cross tabulate species over mass',
format => 'JSON');
```
In the example above the function `ToDSLCode` figured out that the sequence of commands (separated by semicolon)
specifies a
[data transformation workflow](https://github.com/antononcube/Raku-DSL-English-DataQueryWorkflows).
See [AAr2].
Here is an example using Bulgarian data transformation spec that explicitly specifies:
- DSL parser to use (with the first command)
- Language (Bulgarian)
- Default targets spec that is usually a programming language name ("Python")
```perl6
ToDSLCode('
DSL module DataQueryWorkflows;
използвай dfStarWars;
избери колоните name, species, mass и height;
крос табулация на species върху mass',
language => 'Bulgarian',
default-targets-spec => 'Python',
format => 'Code');
```
The function `dsl-translation` is a version of `ToDSLCode` that intended to be used in
command line and web interfaces. It returns a `Hash` object. Here is an example:
```perl6
my %res = dsl-translation('
USER ID dd7833sa;
DSL MODULE DataQueryWorkflows;
use dfStarWars;
select the columns name, species, mass and height;
cross tabulate species over mass');
.say for %res;
```
------
## References
### Videos
[AAv1] Anton Antonov,
["Multi-language Data-Wrangling Conversational Agent"](https://www.youtube.com/watch?v=pQk5jwoMSxs),
(2020),
Wolfram Technology Conference 2020.
[AAv2] Anton Antonov,
["Raku for Prediction](https://www.youtube.com/watch?v=frpCBjbQtnA),
(2021),
The Raku Conference 2021.
### Repositories
[AAr1] Anton Antonov,
["Raku for Prediction" book](https://github.com/antononcube/RakuForPrediction-book),
(2021),
[GitHub/antononcube](https://github.com/antononcube).
[AAr2] Anton Antonov,
[DSL::English::DataQueryWorkflow Raku package](https://github.com/antononcube/Raku-DSL-English-DataQueryWorkflows),
(2020),
[GitHub/antononcube](https://github.com/antononcube).