Yet Another Useless Language Part 9 — Standard library

This is the ninth part of the YAUL series. For your convenience you can find other parts in the table of contents in Part 1 — Introduction

Today we are going to describe standard library for YAUL.


Every language has it’s own set of common functions. This is probably the most important part of language — programmers do not want to implement basic stuff and they want to use existing API. This is why we should provide common functions for manipulating numbers, strings, arrays. Consider LINQ — it is very powerful part of C#, without it we would need to write boring loops over and over again. However, having LINQ we can simply compose functions invocations and quickly transform collections.


Let’s see the implementation:

We represent every library function as simple expression, so we can implement them using lambdas. As you can see, it is pretty straightforward. Please also notice that we have a function for printing. We can handle it directly in our parser in this way:

It is just a direct call to function provided in a standard library.


Well, our language is almost complete. Next time we will finish our parser and try to handle parsing errors. In the last part we will see how to compile YAUL programs to binaries and store them on the hard drive.