-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
:properties: | ||
:id: 4537C384-FB75-AE04-CC0B-92C4DC2EB4EC | ||
:masd.technical_space: masd | ||
:end: | ||
#+title: masd | ||
#+options: <:nil c:nil todo:nil ^:nil d:nil date:nil author:nil | ||
#+tags: { package(p) technical_space(t) } | ||
|
||
* Technical spaces :package: | ||
:properties: | ||
:id: 935423FD-792F-1E74-58DB-250126C2B340 | ||
:end: | ||
|
||
Kurtev /et al./ proposed acrshortpl:ts in their seminal paper | ||
cite:kurtev2002technological, defining them as follows: "A technological space | ||
is a working context with a set of associated concepts, body of knowledge, | ||
tools, required skills, and possibilities." Mens and Van Gorp subsequently | ||
\marginpar{Definition} updated the language and tightened the notion by | ||
connecting it to metametamodels: "A technical space is determined by the | ||
metametamodel that is used (M3-level)." cite:mens2006taxonomy (/cf,/ Section | ||
[[#metamodelling-hierarchy]]) Examples of acrshortpl:ts include acrshort:mde itself, | ||
acrshort:xml, Java and other such programming languages. | ||
|
||
#+begin_src bibtex :tangle yes | ||
@article{kurtev2002technological, | ||
title={Technological spaces: An initial appraisal}, | ||
author={Kurtev, Ivan and B{\'e}zivin, Jean and Aksit, Mehmet}, | ||
journal={CoopIS, DOA}, | ||
volume={2002}, | ||
year={2002} | ||
} | ||
#+end_src | ||
|
||
In cite:bezivin2003first, Bézivin /et al./ outlines their motivation: "The | ||
notion of TS allows us to deal more efficiently with the ever-increasing | ||
complexity of evolving technologies. There is no uniformly superior technology | ||
and each one has its strong and weak points." The idea is then to engineer | ||
\marginpar{Motivation} bridges between technical spaces, allowing the importing | ||
and exporting of artefacts across them. These bridges take the form of adaptors | ||
called "projectors", as Bézivin explains (/emphasis ours/): | ||
|
||
#+begin_src bibtex :tangle yes | ||
@inproceedings{bezivin2003first, | ||
title={First experiments with the ATL model transformation language: Transforming XSLT into XQuery}, | ||
author={B{\'e}zivin, Jean and Dup{\'e}, Gr{\'e}goire and Jouault, Fr{\'e}d{\'e}ric and Pitette, Gilles and Rougui, Jamal Eddine}, | ||
booktitle={2nd OOPSLA Workshop on Generative Techniques in the context of Model Driven Architecture}, | ||
volume={37}, | ||
year={2003} | ||
} | ||
#+end_src | ||
|
||
#+begin_quote | ||
/The responsibility to build projectors lies in one space/. The rationale to | ||
define them is quite simple: when one facility is available in another space and | ||
\marginpar{Projectors,\\ injectors,\\ extractors} that building it in a given | ||
space is economically too costly, then the decision may be taken to build a | ||
projector in that given space. There are two kinds of projectors according to | ||
the direction: /injectors/ and /extractors/. Very often we need a couple of | ||
injector/extractor to solve a given problem. cite:bezivin2005model | ||
#+end_quote | ||
|
||
acrshortpl:ts are a useful --- if somewhat imprecise[fn:ts_imprecise] --- | ||
conceptual device and bridging across them has been demonstrated to work in | ||
\marginpar{Challenges} practice cite:bezivin2003first. However, our position is | ||
that to fully fulfil their promise, an extraordinary engineering effort is | ||
required to model all significant features from existing acrshortpl:ts, to | ||
expose them to modeling languages and to keep those models updated. As we shall | ||
see in the next section, much of the same challenges apply to platforms. | ||
|
||
[fn:ts_imprecise] In the words of Bézivin /et al./ | ||
cite:bezivin2003first (/emphasis ours/): "Although /it is difficult to | ||
give a precise definition of a Technological Space/, some of them can | ||
be easily identified, for example: programming languages concrete and | ||
abstract syntax (Syntax TS), Ontology engineering (Ontology TS), | ||
XML-based languages and tools (XML TS), Data Base Management Systems | ||
(DBMS TS), Model-Driven Architecture (MDA TS) as defined by the OMG as | ||
a replacement of the previous Object Management Architecture (OMA) | ||
framework." | ||
|
||
|
||
** C++ | ||
:properties: | ||
:id: ED434D4E-C821-1544-AC4B-A05B266B997E | ||
:end: | ||
|
||
C++ is a programming language that was developed by Bjarne Stroustrup at Bell | ||
Labs in 1979. It is an extension of the C language, providing object-oriented | ||
programming features like classes and objects to it. The "++" in the name refers | ||
to the fact that it is an improvement over C, with additional capabilities for | ||
programming complex systems. C++ is widely used for system programming, game | ||
development, and other performance-critical applications due to its efficiency | ||
and versatility. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
:properties: | ||
:id: 26C11B63-95AE-D454-4663-0B147D32B568 | ||
:end: | ||
#+title: progen | ||
#+options: <:nil c:nil todo:nil ^:nil d:nil date:nil author:nil | ||
#+tags: { element(e) attribute(a) module(m) } | ||
|
||
:PROPERTIES: | ||
:END: | ||
|
||
Progen, the /product generator/ is MASD's second generation code generator. MASD | ||
(Model Assisted Software Development) is a methodology for software development | ||
based on MDE (Model Driven Engineering). See my PhD thesis for more details: | ||
[[https://uhra.herts.ac.uk/handle/2299/25708][Model Assisted Software Development - a MDE-Based Software Development | ||
Methodology]]. Progen is based on Data-Oriented Design (DOD) principles. For | ||
more details on DOD, see the [[https://www.dataorienteddesign.com/dodbook/][Data-Oriented Design]] book by Richard Fabian. | ||
|
||
* progen :element: | ||
:PROPERTIES: | ||
:custom_id: 1F82B9DD-2C25-1A04-8FA3-23669A544C82 | ||
:END: | ||
|
||
Represents the product model for progen. | ||
|
||
* readme :element: | ||
:PROPERTIES: | ||
:custom_id: 7CF88053-7F81-98E4-851B-6916CB4D82C5 | ||
:END: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.12) # You can adjust the minimum version as needed | ||
|
||
project(MyCppProject) | ||
|
||
# Set the C++ standard to C++11 or higher | ||
set(CMAKE_CXX_STANDARD 11) # Change to 14, 17, or 20 as needed | ||
|
||
# Add the executable target | ||
add_executable(MyCppProject main.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
:properties: | ||
:id: 02E29EFE-34EE-4614-882B-8EA856275D97 | ||
:masd.technical_space: [[id:ED434D4E-C821-1544-AC4B-A05B266B997E][c++]] | ||
:masd.variability.profile: [[id:17E27354-905F-BBF4-53CB-843CADC4D754][some_profile]] | ||
:end: | ||
#+title: model.name | ||
#+options: <:nil c:nil todo:nil ^:nil d:nil date:nil author:nil | ||
#+tags: { package(p) class(c) attribute(a) operation(o) parameter(b) } | ||
|
||
Some description. | ||
|
||
* Some namespace :package: | ||
:properties: | ||
:id: 17E27354-905F-BBF4-53CB-843CADC4D754 | ||
:end: | ||
|
||
A namespace description. | ||
|
||
** A class :class: | ||
:properties: | ||
:id: 0109B911-66B2-1D24-A7D3-2F3F86989180 | ||
:end: | ||
|
||
A class description. | ||
|
||
*** An attribute :attribute: | ||
:properties: | ||
:id: FA0D7B49-2FC0-81C4-1E1B-5A71F533A6F3 | ||
:PROGEN_TYPE: [[id:02E29EFE-34EE-4614-882B-8EA856275D97][model.name]] | ||
:END: | ||
|
||
An attribute description. | ||
|
||
*** An Operation :operation: | ||
:PROPERTIES: | ||
:ID: 0F16B2D4-6926-65E4-523B-6F27E60D64AF | ||
:PROGEN_TYPE: [[id:02E29EFE-34EE-4614-882B-8EA856275D97][model.name]] | ||
:END: | ||
|
||
An operation description. | ||
|
||
**** First parameter :parameter: | ||
:PROPERTIES: | ||
:ID: 0F16B2D4-6926-65E4-523B-6F27E60D64AF | ||
:PROGEN_TYPE: [[id:02E29EFE-34EE-4614-882B-8EA856275D97][model.name]] | ||
:END: | ||
|
||
A parameter description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <vector> | ||
#include <boost/spirit/include/qi.hpp> | ||
#include <boost/fusion/adapted/std_pair.hpp> | ||
|
||
namespace qi = boost::spirit::qi; | ||
namespace ascii = boost::spirit::ascii; | ||
|
||
// Struct to store parsed Org-Mode elements | ||
struct OrgElement { | ||
int level; | ||
std::string heading; | ||
std::vector<std::string> listItems; | ||
}; | ||
|
||
// Grammar definition using Boost Spirit | ||
template <typename Iterator> | ||
struct OrgGrammar : qi::grammar<Iterator, OrgElement(), ascii::space_type> { | ||
OrgGrammar() : OrgGrammar::base_type(start) { | ||
using namespace qi; | ||
|
||
heading %= repeat(1, 6)[char('*')] >> +ascii::space >> lexeme[+(char_ - eol)]; | ||
listItem %= +ascii::space >> '-' >> +ascii::space >> lexeme[+(char_ - eol)]; | ||
content %= (heading | listItem) >> eol; | ||
start %= *content; | ||
} | ||
|
||
qi::rule<Iterator, std::string()> heading; | ||
qi::rule<Iterator, std::string()> listItem; | ||
qi::rule<Iterator, OrgElement(), ascii::space_type> content; | ||
qi::rule<Iterator, OrgElement(), ascii::space_type> start; | ||
}; | ||
|
||
int main() { | ||
std::string input = | ||
"* Heading 1\n" | ||
" - Item 1\n" | ||
" - Item 2\n" | ||
"** Heading 1.1\n" | ||
" - Nested Item 1\n" | ||
"* Heading 2\n"; | ||
|
||
std::vector<OrgElement> orgElements; | ||
OrgGrammar<std::string::iterator> parser; | ||
|
||
auto begin = input.begin(); | ||
auto end = input.end(); | ||
|
||
bool success = qi::phrase_parse(begin, end, parser, ascii::space, orgElements); | ||
|
||
if (success && begin == end) { | ||
for (const OrgElement& element : orgElements) { | ||
std::cout << "Level: " << element.level << ", Heading: " << element.heading << std::endl; | ||
for (const std::string& item : element.listItems) { | ||
std::cout << " - " << item << std::endl; | ||
} | ||
} | ||
} else { | ||
std::cerr << "Parsing failed" << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters