Skip to content

General improvements #8

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ Description: Customize Programming Languages

LangTrans customizes any programming language. You can make your own syntax for any programming language.

## How it works?

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. 

LangTrans takes both as input and converts code written in the new syntax to the original syntax.
## How does it work?

LangTrans transpiles your syntax into the original syntax. 

You define tokens from your language, and a template of the original language's syntax, using regular expressions. 

LangTrans takes both definitions as input and converts code written in the new syntax to the original syntax.
18 changes: 8 additions & 10 deletions command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@
py langtrans.py <SoureFileName> <OutputFileName> <SyntaxRepr> <PatternRepr>
```

**SourceFileName** - File name of source code written with new syntax
**SourceFileName** - Name of the file with source code to transpile

**OutputFileName** - File name of source code you want to generate with original syntax
**OutputFileName** - Name of the file to output to

**SyntaxRepr** - File name of YAML file for [token extraction](implementation.md#token-extraction) without extension(.yaml)
**SyntaxRepr** - File name of YAML file with [definition of tokens](implementation.md#token-extraction) (without .yaml extension)

**PatternRepr** - File name of YAML file with [template](implementation.md#template) of original language without extension
**PatternRepr** - File name of YAML file with [template](implementation.md#template) of original language (without .yaml extension)

### **Compile**
### **To Compile**

```bash
py langtrans.py -c <SyntaxRepr> <PatternRepr> <compfile>
```

**compfile**

Name of compiled file(without extension)
Name of output file (without extension); compiles and generates `filename.ltz`.

`filename.ltz` will be generated.

### **Run**
### **To Run**

```bash
py langtrans.py -f <SoureFileName> <OutputFileName> <compfile>
Expand All @@ -41,7 +39,7 @@ py langtrans.py -f <SoureFileName> <OutputFileName> <compfile>

### **Docs for token extraction file**

To generate documentation for [token extraction](implementation.md#syntax) file
To generate documentation for [definition of tokens](implementation.md#syntax) file, run:

```bash
py langtrans.py -d <SyntaxRepr> > filename.txt
Expand Down
4 changes: 2 additions & 2 deletions downloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Some feature shown works only in latest version in [GitHub Repo](https://github.com/LangTrans/LangTrans)
{% endhint %}

* [Standalone](https://github.com/LangTrans/LangTrans/releases/download/1.6/langtrans.exe)
* [Installer](https://github.com/LangTrans/LangTrans/releases/download/1.6/LangTrans\_Installer.exe)
* [Standalone](https://github.com/LangTrans/LangTrans/releases/download/latest/langtrans.exe)
* [Installer](https://github.com/LangTrans/LangTrans/releases/download/latest/LangTrans\_Installer.exe)
* [Releases](https://github.com/LangTrans/LangTrans/releases)
* [GitHub Repo](https://github.com/LangTrans/LangTrans)
23 changes: 11 additions & 12 deletions implementation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Implementation

To customize you should extract tokens with regular expression. Then you should create the template of original language with token you extracted.
To customize, you define tokens for your new syntax using regular expressions. Then you create the template of the original language by referencing the tokens you defined.

## Token Extraction

Expand All @@ -26,10 +26,9 @@ typeofsynax:
_1typeofsyntax:
regex: regex2
tokens: [token1,token2,token3]
#Code here(like above)
#...................
#...................
# More lines of code
#...................

settings:
collections:
collection_name: [typeofsyntax1,typeofsyntax2]
Expand All @@ -54,13 +53,13 @@ settings:

Name of syntax you wanted to match

**Eg. **arithmetic, loop etc.
**Eg.** arithmetic, loop etc.

If one type have same pattern but different regular expression to match.&#x20;

You can write `_<any character><typeofsyntax>` for next regex.

**Eg. **`_1typeofsyntax`
**Eg.** `_1typeofsyntax`

Both regex use one template

Expand Down Expand Up @@ -90,11 +89,11 @@ If it is False it works only after calling it otherwise it works normally.

If it is True it works only once

**next**
#### **next**

To pass converted syntax into another or same typeofsyntax

**token1**
#### **token1**

To modify token1 matched

Expand Down Expand Up @@ -130,11 +129,11 @@ For setting variables, collections, after command

{% tabs %}
{% tab title="variables" %}
You can make variables than can used inside [regular expression](implementation.md#regex) by `<varname>`
You can make variables than can be used inside [regular expressions](implementation.md#regex) by `<varname>`
{% endtab %}

{% tab title="varfile" %}
Name of YAML file to import variables
Name of YAML file that defines variables

{% hint style="info" %}
Filename doesn't need extension (base name only)
Expand Down Expand Up @@ -169,9 +168,9 @@ YAML file with error definitions for [linting](implementation.md#linting)
{% endtabs %}

{% hint style="info" %}
__[_regex_ ](implementation.md#regex)and [_tokens_ ](implementation.md#tokens)should be in all typeofsyntax.&#x20;
[_regex_ ](implementation.md#regex)and [_tokens_ ](implementation.md#tokens)should be in all typeofsyntax.&#x20;

Others are optional
Other options are optional.
{% endhint %}

### Example
Expand Down