-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a universal proto language
Which will act mediator language between the different languages. Add new files and refactor code to implement AST-based parsing and translation of GCode New source and header files added for Abstract Syntax Tree (AST) based system to handle GCode translation. This change helps improve code maintainability by unifying parsing and translation functionality. The changes also include modification of existing files, classes, and function signatures to accommodate and support the new system. Notably, new classes for AST nodes, such as Translate, ast_t and node_t have been designed. For parsing GCode, a factory class is created that maps GCode instructions to corresponding AST nodes. For translating GCode to Proto Path, a translate function is added. Also, to make it more readable and aligned, the code has been refactored, primarily renaming and relocating components for better structure. Furthermore, file and class headers were renamed to match current usage. Contribute to CURA-10561
- Loading branch information
1 parent
01c2c33
commit 1f7a92a
Showing
28 changed files
with
293 additions
and
144 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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,34 +1,15 @@ | ||
#ifndef DULCIFICUM_INCLUDE_DULCIFICUM_GCODE_PARSE_H | ||
#define DULCIFICUM_INCLUDE_DULCIFICUM_GCODE_PARSE_H | ||
#ifndef INCLUDE_DULCIFICUM_GCODE_PARSE_H | ||
#define INCLUDE_DULCIFICUM_GCODE_PARSE_H | ||
|
||
#include "dulcificum/gcode/ast/ast.h" | ||
|
||
#include <spdlog/spdlog.h> | ||
|
||
#include <cstddef> | ||
#include <sstream> | ||
#include <string> | ||
#include <string_view> | ||
|
||
namespace dulcificum::gcode | ||
{ | ||
|
||
ast::ast_t parse(std::string_view content) | ||
{ | ||
std::istringstream stream(content.data()); | ||
std::string line; | ||
ast::ast_t ast; | ||
|
||
size_t index{ 0 }; | ||
while (std::getline(stream, line)) | ||
{ | ||
ast.emplace_back(ast::factory(index++, line)); | ||
} | ||
|
||
return ast; | ||
} | ||
|
||
ast::ast_t parse(std::string_view content); | ||
|
||
} // namespace dulcificum::gcode | ||
|
||
#endif // DULCIFICUM_INCLUDE_DULCIFICUM_GCODE_PARSE_H | ||
#endif // INCLUDE_DULCIFICUM_GCODE_PARSE_H |
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
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
Oops, something went wrong.