1. Home
  2. Compiler

Compiler

‘Computer language that anyone can read’ launches Aeternity compiler

Lexon now features a compiler that allows users to translate code from it to Solidity, Sophia or JavaScript.

Smart contract computer language Lexon (LEX) launched a compiler on Aug. 3, allowing developers to write contracts in Lexon and have them be converted into Solidity, Sophia or JavaScript, according to statements made to Cointelegraph by Lexon founder Henning Diedrich. The compiler runs on the Aeternity (AE) blockchain network and charges LEX tokens as payment for each compilation cycle.

Dubbed “the computer language anyone can read,” Lexon is a computer language intended to seem like an ordinary written or spoken language. Specifically, the current version is developed to look and sound like ordinary English.

Lexon (left) being compiled into Solidity (right). Source: Lexon

In a conversation with Cointelegraph, Diedrich claimed that the language and compiler provide three main benefits to developers and users. First, it can be used as an educational tool to teach smart contract programming. Remix, a popular tool for learning Solidity, has developed a Lexon plugin that allows students to type agreements in Lexon and see their translations in Solidity, enabling them to understand what the Solidity code means in plain English. In Diedrich’s view, this can help students comprehend how Solidity and smart contracts work.

Second, contracts can be written in Lexon to make them “self-documenting.” Instead of a technical writer needing to write documentation explaining what the code does, the code itself can be written in a language that ordinary people can understand. Programmers have been trying to develop algorithms that can produce documentation from a set of code, but Lexon approaches the problem differently, making the code readable, Diedrich claimed.

Third, Lexon can be used to produce better graphical user interfaces (GUIs) and in a more automated way. “You can use the richness of the information to create better GUIs, because you can generate more from [this] human way of expressing the logic, than you can when you take as a starting point the third-generation language like Solidity,” Diedrich stated.

Related: How to detect fake news with natural language processing

Diedrich cautioned that the compiler can only translate in one direction, from Lexon to another language. It cannot translate another computer language back into Lexon. This means that it can’t be used, for example, to more easily debug smart contracts that were not initially written in Lexon, as he explained:

“Natural language is, of course, very much richer than third-generation languages like solidity. [...] And the act of leaving things out is actually something that the compiler does. [...] This first translation step is losing so much information that the way back is really difficult. [...] Because it can never be as good as Lexon itself.”

However, he argued that if Lexon were to become a common language for smart contract programming, this would make it easier for ordinary people to understand how Web3 apps actually function, which would accomplish the same objective that a Solidity-to-Lexon compiler would.

According to Diedrich, the team chose Aeternity because of its low gas fees and high scalability. The team is currently distributing LEX in exchange for AE tokens.

The difficulty of reading Solidity contracts continues to be a stumbling block for decentralized finance users. Users who don’t know how to code must often rely on smart contract security auditors to determine whether a contract has a vulnerability, and this can leave them vulnerable to undiscovered exploits. On July 2, an exploiter removed over $1 million of users’ funds from the Chibi Finance app without their permission in what has been described by security researchers as a “rug pull.” The exploiter used a function called “panic” to drain the funds, and most users didn’t know this function existed.

In a similar example on July 28, investors plowed at least $2 million into the Pond0x (PNDX) memecoin only to find out that its transfer function allowed anyone to transfer Pond0x coins without the owners’ consent. The Pond0x token quickly collapsed in price to near zero.

Crypto Advocacy Group Coin Center Names Top Three Threats Against Digital Asset Industry

Compiler vs. interpreter: Key differences

Learn about the crucial differences between compilers and interpreters and how they affect code execution and development.

Compilation and interpretation are the two primary methods for executing code in the realm of programming. In order for computers to comprehend and execute high-level programming languages, compilers and interpreters are essential tools. Although they have this in common, how they go about achieving it and how it affects program performance are very different. 

To better understand their respective functions in the software development process, this article will examine the main distinctions between interpreters and compilers.

What are compilers and interpreters?

Compiler

The complete source code of a program produced in a high-level programming language is simultaneously translated into machine code (binary code) by a compiler, a specialized tool. There are numerous phases of the compilation process that are typical, including lexical analysis, syntactic analysis, semantic analysis, optimization and code creation. A standalone executable file produced by a compiler can be run directly by the operating system.

Interpreter

An interpreter, on the other hand, is a program that reads a program’s source code line by line and runs it immediately without first creating a file of intermediate machine code. The interpreter quickly executes each statement after translating it into machine code or intermediate code, rather than translating the entire program at once. This means that when a program is running, the source code is read and translated in real time.

Comparing compilation and interpretation

Execution process

The execution process is one of the key distinctions between interpreters and compilers. Before running, a compiler converts the complete source code into machine code, creating a standalone executable file. As a result of the conversion being completed beforehand, the built software often runs faster. But the initial compilation procedure can take a while, particularly for big programs.

An interpreter, on the other hand, does not create a standalone executable. Instead, it runs the source code line by line while reading and executing it immediately. As a result, development input may be given more quickly because changes can be tested right away without having to recompile. However, because of the potential cost of the interpretation process, interpreted programs are typically slower than compiled ones.

Related: Top 10 most famous computer programmers of all time

Portability

Compiled applications are closely tied to a particular operating system and hardware architecture because compilers produce machine code unique to the target platform. A program compiled for one platform may not be able to execute on another without modification or recompilation due to this lack of portability.

Instead of creating machine code files, interpreters immediately execute the source code, making them often platform-neutral. This makes it simpler to port interpreted programs between several systems, provided that the right interpreter is accessible for each target platform.

Error detection

The methods used for error detection in compilation and interpretation are also different. Before producing machine code, a compiler thoroughly examines the entire source code. As a result, it may detect a variety of mistakes during compilation, including logical flaws, type issues and syntax errors. The compiler will produce an error message with a list of all the errors found in the code, making it easier for the developer to find and fix them.

Related: 10 emerging technologies in computer science that will shape the future

An interpreter, on the other hand, halts operation when it comes across the first error in the code. As a result, error detection with interpreted languages is quicker. However, because the interpreter only reports the first fault it finds, further problems with the code could go unreported until the initial error has been repaired and the code has been run again.

Crypto Advocacy Group Coin Center Names Top Three Threats Against Digital Asset Industry