New language testing module

Does anyone know if there is a standardized process for unit testing a new language.

I mean, any new language will have basic flow control like IF, CASE, etc.

How is the language itself usually tested?

+3


source to share


2 answers


Unit testing is one strategy for achieving a goal: make sure that a piece of software meets the specified specification. Let's assume you are more interested in a goal and not solely for unit testing to achieve it.

The question of verifying that a language conforms to a specification or exhibits special desirable qualities is deep. The earliest work led to type theory, in which the language is usually extended with new syntax and rules to speak of well-typed programs: programs that obey these new rules.

Hand in hand with these extensions are mathematical proofs demonstrating that any well-typed program will exhibit various desirable qualities. For example, perhaps a well-typed program will never try to do integer arithmetic on a string, or try to access an element from outside the array.



To ensure that programs are well typed before they are allowed to execute, it is possible to effectively extend these guarantees from well typed programs to the language itself.

Type systems can be classified according to the types of rules they include, which in turn determines their expressive power. For example, most common typed languages โ€‹โ€‹can check my first case above, but not the second. With the added power comes more complexity: their type checking algorithms are correspondingly harder to write, reason, etc.

If you want to know more, I suggest you read this book , in which you will get the basics of functional programming through generic types.

+3


source


You can see what other languages โ€‹โ€‹are doing for testing. When I was developing the language, I thought about doing something like Python. They have tests written in python itself.

You can find their tests. Some of them are grammar , types , exceptions , etc.



If you are looking for examples, there is a lot of good stuff out there, so I recommend you dig in :).

0


source







All Articles