Skip to content

faqs added and made slight changes #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,9 +10,48 @@ LangTrans customizes any programming language. You can make your own syntax for

LangTrans converts your syntax into the original syntax. 

Regular expressions extract tokens from your language. You should make a template of the original language syntax. 
Regular expressions(REGEX) extract tokens from your language. You should make a template of the original language syntax. 

LangTrans takes both as input and converts code written in the new syntax to the original syntax.



## FAQs:
- question: What is the purpose of this implementation?
answer:
This implementation aims to provide a customizable way to transform code syntax from one programming language to another. It involves token extraction, syntax template creation, and error linting to facilitate efficient and accurate code translation.

- question: How do I customize the token extraction process?
answer:
You can customize token extraction by defining regular expressions for each token you want to extract. These tokens represent specific elements in the code you're translating. You can also use modifiers like `unmatch`, `global`, `once`, and others to tailor the extraction process to your needs.

- question: Can I reuse the same token extraction rules in different syntax templates?
answer:
Yes, you can reuse the same token extraction rules by creating multiple `typeofsyntax` blocks that share the same pattern. You can differentiate them by using an underscore and a unique identifier, such as `_1typeofsyntax`.

- question: How do I create syntax templates for the target language?
answer:
Syntax templates are created using placeholders for the extracted tokens. Simply use the extracted token names within the template. For example, if you have an extracted token named `var`, you can use `<var>` in the syntax template to represent that token's value.

- question: What is the purpose of the linting feature?
answer:
The linting feature helps you identify and highlight potential errors in the translated code. By defining error patterns using regular expressions, you can automatically detect problematic code segments and provide associated error messages and help suggestions.

- question: Can I define linting rules for specific code patterns?
answer:
Yes, you can define linting rules both within `typeofsyntax` blocks to target specific code patterns related to that syntax and in the `outside` block to target general code patterns throughout the source code.

- question: How do I handle errors related to the translated code?
answer:
When linting identifies an error in the translated code, it will display the error message you defined in the linting rules. The associated help message provides guidance on how to resolve the error and improve the translation.

- question: Is there a way to group similar `typeofsyntax` blocks together?
answer:
Yes, you can use the `collections` setting to group similar `typeofsyntax` blocks. This grouping can be helpful when using the `call` and `next` features, as it allows you to reference and pass data between related syntax blocks.

- question: How do I integrate this implementation into my workflow?
answer:
After creating your custom token extraction rules, syntax templates, and linting rules, you can run the implementation on your source code. The `after` setting allows you to execute additional command-line commands after the translation process, enabling seamless integration into your development workflow.

- question: How can I provide feedback or report issues with this implementation?
answer:
We appreciate your feedback! You can report suggestions, and improvements in the [LangTrans Repos](https://langtrans.github.io/langtransrepos/), where you can connect with the community and contribute to the ongoing development of this implementation.
1 change: 1 addition & 0 deletions getting-started.md
Original file line number Diff line number Diff line change
@@ -89,3 +89,4 @@ py langtrans.py -f filename.ext filename.py py
`filename.py`will be generated. It contain the transpiled code

Run`filename.py`

7 changes: 6 additions & 1 deletion implementation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Implementation

To customize you should extract tokens with regular expression. Then you should create the template of original language with token you extracted.
Steps Involved:

Token extraction
Syntax template creation
Error linting

## Token Extraction

@@ -297,3 +301,4 @@ outside:
{% hint style="info" %}
You can share your syntax in [LangTrans Repos](https://langtrans.github.io/langtransrepos/)
{% endhint %}