DEV Community

Bijin Regi Panicker
Bijin Regi Panicker

Posted on • Edited on

Customize Programming Languages

This post is to introduce LangTrans.

LangTrans is preprocessor to convert code written in your syntax into code in original syntax.

You can create syntax for
  • your own needs
  • project needs
  • your domain

No need to know about inner workings of compiler.
Knowledge about regular expression is only prerequisite.

GitHub logo LangTrans / LangTrans

Customize programming languages

LangTrans

To customize any programming language

Discord Docs License

LangTrans is a syntactic preprocessor
It helps you to customize the syntax of any programming language
It converts customized syntax to original syntax.
It uses regular expression but it supports nesting(called part calling).

Example

Customized Syntax of Python
#Print
p"Hello World"
# Anonymous function
inc = (x) => x+1
# Lambda function
twice(x) = 2*x
# Single Line try-except
try inc("1") Exception print("Error:",err)
# Print Done if x is defined other wise Failed
print((x||True)?"Done":"Failed")
# Single Line if and check x defined or not
print('x is not defined') if !x
# Pipe Syntax
1 -> inc
|> print
# Arithmetic operations with functions 
print((inc+twice)(3))
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
brp profile image
Bijin Regi Panicker • Edited

If you have any suggestions to make it more effective or find any fault, let's discuss.