Draft:Nytril (Programming Language)
Submission declined on 13 June 2025 by Sophisticatedevening (talk).
Where to get help
How to improve a draft
You can also browse Wikipedia:Featured articles and Wikipedia:Good articles to find examples of Wikipedia's best writing on topics similar to your proposed article. Improving your odds of a speedy review To improve your odds of a faster review, tag your draft with relevant WikiProject tags using the button below. This will let reviewers know a new draft has been submitted in their area of interest. For instance, if you wrote about a female astronomer, you would want to add the Biography, Astronomy, and Women scientists tags. Editor resources
| ![]() |
Comment: Sourced exclusively by their own website. Sophisticatedevening🍷(talk) 01:21, 13 June 2025 (UTC)
Comment: In accordance with Wikipedia's Conflict of interest policy, I disclose that I have a conflict of interest regarding the subject of this article. ShawnMcCreight (talk) 00:30, 13 June 2025 (UTC)
![]() | The following Wikipedia contributor has declared a personal or professional connection to the subject of this page. Relevant policies and guidelines may include conflict of interest, autobiography, and neutral point of view.
|
Nytril is a high-level, general purpose programming language that runs in an integrated development environment for Windows and Mac computers. The standard output of a nytril program is one or more typeset documents that can be published. The software is available for download at www.nytril.com. A Community Edition is available for free.
Nytril has a 'C' style, with insignificant white space, expressions separated by a semi-colon (;), and scope enclosed by curly braces {}. It uses almost all the standard C++ operators and flow statements. It supports both dynamic and static typing or a mix of the two. Namespaces can be created and used to organize symbols. It is an object oriented language with classes, single-inheritance, virtual functions and templates. Memory is managed, with automatic garbage collection.
Nytril contains built-in support for creating complex typeset documents, including alignments, tables, charts, drawings, and complex math layout, in the spirit of LaTeX. Nytril is not a markup language like html or markdown, but the grammar has a unique property called 'affinity' that allows the fluid mixing of calculations and text with a minimum of operators and escapes. Because it is a conventional programming language, Nytril allows for arbitrarily complex calculations to be performed in the usual way, and then inserted inline with the text with minimal punctuation.
History
[edit]Inspired by the difficulty of creating technical documents that were easy to maintain, Shawn McCreight began developing Nytril software in 2017. He wanted to build an application that would allow authors to create and manage large groups of related technical documents in multiple languages. The name nytril was suggested by his daughter Megan, as a way to imply 'alternative to latex'.
John Colbert joined in 2020, and the goal of the project expanded significantly to include online publishing and search. John's experience in database and web programming gave rise to the integrated desktop-web nature of Nytril. John and Shawn worked together at Guidance Software and both are on the board of D6 Labs.
Daniel Tyebkhan worked as an intern and built the GitHub integration and did pivotal work toward an Avalonia integration that resulted in the Mac version of Nytril. He also completed the second large-scale nytril implementation for a company's product spec sheets.
Megan McCreight worked as an intern and built the database API as well as many of the example programs.
Nytril 1.1 was released in June, 2025.
Design Philosophy and Features
[edit]A guiding principle of Nytril development is the DRY principle in programming (i.e. Don't Repeat Yourself). To make a large number of similar documents, without repeating information, the data and text must be separated from the style and the organization of the documents themselves. In this pattern, the documents are only a temporary representation of the text and data, and they can be discarded and rebuilt from source automatically, in the same way that an executable program can be rebuilt from source. When this source changes, the entire corpus of documents is rebuilt, which guarantees that every document is always up to date.
The Nytril language is influenced by the syntax and conventions of TypeScript, C# and LaTeX languages but it is a hybrid that is easy for beginners to learn. Nytril source files are UTF8 text files compatible with Git and Subversion, and several authors can collaborate on different parts of the document set, in the same way that they would collaboration different parts of a large software project. Raw information can be coded in Nytril source files in a structured way, minimizing the need for data to be stored in different formats like JSON and XML. All changes to data and style can be tracked by source control which enhances recoverability and accountability. Using source control tracking means that a small change to a data point or style shows up as a single change, even though it might affect hundreds of separate documents.
Nytril is an integrated desktop environment and the experience of authoring is a cross between Visual Studio and Excel because the calculations and graphical output are visible immediately inside the application. All execution and formatting is done on the desktop, so work can be done offline and synced later.
Portability
[edit]Nytril is written in C# and uses the latest version of the Microsoft .Net platform. Nytril is portable across operating systems and CPU architectures. Currently Nytril runs on computers running Windows 10 and later and MacOS 12 and later. On Windows, the GUI uses the WPF framework and on the Mac, it uses Avalonia, however the programming interfaces, user interface, menus and document views are identical.
The compiler, runtime library and math functions are identical on all platforms. Typesetting layout may differ marginally on different platforms due to the use of different underlying graphics frameworks. The long-term goal is to remove all the visible differences between the platforms.
The compiler
[edit]Nytril is a compiled language and the code for the entire program is compiled before any of the statements are executed. The program is compiled at project load and in the background as the programmer types. The compiled program resides in memory and is discarded and rebuilt in the background each time the program is opened or changed. The compile time for a program is usually less than one second.
Nytril has a 2-pass compiler. Pass 1 gathers any included files and libraries and then builds namespaces and class definitions. Pass 2 compiles global and class functions. Two passes allow the programmer to reference classes and variables before they are declared in code, as in modern C++ variants like C# and Typescript. Classes and member functions are defined together in one scope, in a single source file. There are no 'header' files as in C and C++.
Instead of a project file, a program's functionality is determined entirely by its main source file. The compiler simply follows the chain of included files starting with the main file, with redundant include files being ignored. All symbols are visible to every included file, unless they are marked private.
There is not a single entry point for a Nytril program (i.e. no main() function). Once compiled, various parts of the program can run when called. This is usually in the form of producing typeset output. For instance, an object can override methods to show itself in a document or a popup tip.
Conventionally, each program includes a Main.Documents
collection that lists one or more document objects. These are the documents that are available for the program to view on-screen or publish.
A program may also include a Main.Configurations
collection. This is a list of variations of the whole program that the programmer wishes to build for publication. Only one of these is active at a time, and the programmer may selectively define a namespace for certain configuration properties.
Nytril supports compiling and publishing alternate configurations for different languages, measurement units and paper sizes. This provides a way to create a set of documents for every reader, without repeating text or data.
readonly namespace Lang if (Language == Languages.English) {
Hello = "Hello";
}
readonly namespace Lang if (Language == Languages.Spanish) {
Hello = "Hola";
}
readonly Greeting = Lang.Hello;
The Nytril IDE has an integrated document viewer that shows how the document will look when published. All parts of the visible document store a pointer to the part of the code that created them. The Nytril IDE allows the user to control-click on any part of the document and be taken to the source code that was responsible for adding it to the document.
Function syntax
[edit]There are some important syntactic differences between Nytril and other C-style languages regarding function definitions.
- Nytril does not require an empty set of parenthesis () after functions that take no parameters, either on declaration or at the call site.
- As a result, an '@' operator signals that function reference is used as a closure.
- Nytril has an optional inline function declaration syntax that uses an equal (=) sign and a single expression, in lieu of a full {} scope with a return statement.
- A function that returns a value does not need to have a declared return type. If the return type declaration is missing, the return type is assumed to be 'any'. A void return type means that the function returns no value.
These changes are consistent with the goal of having a minimum of operators to increase readability.
Rand1 { // Conventional function definition syntax
return Math.Random(0..9);
}
Rand2 = Math.Random(0..9); // Short-hand function definition
RandPower(x) = Rand1^x; // Rand1 is called with no ()
global functions and namespaces
[edit]Nytril allows global functions that do not belong to a class and have no 'this' pointer. They can be defined globally or inside of a namespace.
F1(x) = x + 1; // F1 defined globally
N1.F2(x) = x + 2; // Create namespace N1 and define F2 inside N1
namespace N2 {
F3(x) = x + 3; // F3 defined inside the namespace N2
}
namespace N2 {
F4(x) = x + 4; // N2 collects all definitions, in compile order
}
readonly global functions
[edit]
If a global function is marked as readonly
, then the function is run the first time it is called anywhere in the program, and the return value is cached. If the function is called again anywhere, the cached value from the first run is returned immediately. This is useful when loading large constant values such as images or the results of database queries or REST calls, where the intention is usually to retrieve information once and then use the same copy for many calculations.
readonly Data = ComplexSlowQuery; // Run only once
readonly Cost = Data.Quantity * Data.Price; // Use like a variable
Affinity operator
[edit]
To create complex formatted text in an easy way, Nytril introduced the affinity operator. In most programming languages, two operands must be separated by a binary operator (e.g. x * y
) or else there is a syntax error. In Nytril, if the compiler encounters two operands without a binary operator between them, it inserts an invisible binary 'affinity' operator and continues without error. At runtime, the type of the two operands is assessed and if an affinity exists between the two types, the operation is executed. If there is no affinity between the types, there is a runtime error.
"123" "abc"
⇒ "123" + "abc"
3 meters
⇒ 3 * meters
Nytril allows the programmer to add left and right affinity between objects of different types, which can create a complex sub-grammar in the language which can increase clarity.
The 'each' Operator
[edit]The each operator is used to call a function with a parameter once for every item in an array. The resulting expression is an array of function return values.
Square(x) = x * x; // Define function
Square(each [1, 2, 3, 4]); // Call function for each item in the array
⇒ [1, 4, 9, 16]
If a function has more than 1 parameter, the each operator can be used on more than 1 argument. This raises the dimension of the output array.
Power(x, power) = x ^ power; // Define function
Power(each [1, 2, 3], each [1, 2, 3]); // Call function in two passes
⇒ [[1, 4, 9], [1, 4, 9], [1, 8, 27]]; // Two-dimensional array result
Most unary and binary operators can also be used in conjunction with the each operator to provide a very compact expression.
(each [1, 2, 3]) ^ (each [1, 2, 3]) // Apply the ^ operator in two passes
⇒ [[1, 2, 3], [1, 4, 9], [1, 8, 27]]; // Two-dimensional result
Revisions
[edit]Revisions are the backbone of coding in Nytril. A revision is a collection of properties and elements inside curly braces {} that are separated by semi-colons (;}. A property is a name: value
pair such as TextHeight: 12 pts
. An element is any other expression, including variables and values returned from function calls. The properties and elements of a revision are computed at runtime, so a revision "executes" just like a scope in a function.
A revision adds elements to, and modifies the properties of, format objects in a document. A revision acts on the format object to its left, without modifying it. The combination of the left-hand operand and the right-hand revision is a new revised object that has the properties and elements of the left-hand format/revision plus any additional elements of the right-hand revision, and the added (or overridden) properties of the right-hand revision. By stacking and combining revisions, hierarchical style dictionaries can be created easily in a manner that is similar to Cascading Style Sheets or to the way word processors allow styles to inherit from each other and override properties.
The following code creates a empty Paragraph and revises it with content and properties. The placement of properties has no effect, but the placement of elements is always in order.
Paragraph {1; 2; 3; "abc"; TextWeight: Bold};
⇒ 123abc The following code creates a paragraph 'style' called Heading1 by revising the Paragraph format with several properties. It then uses the Heading1 style by revising it with a string element.
Heading1 = Paragraph {
TextItalic: true;
TextWeight: Bold
};
Heading1 {
"Chapter 1"
};
⇒ Chapter 1
Revisions + arrays
[edit]Special treatment is given to elements in a revision that are arrays. In this case, all of the elements of the array become elements of the revision, without changing the array. Combining this mechanism with the 'each' operator, described above, allows for the succinct inclusion of iterated content.
Paragraph {
Square(each [1, 2, 3, 4, 5]);
Separator: ", ";
};
⇒ 1, 4, 9, 16, 25
Revisions with if/else
[edit]If statements can be used in a revision to programmatically include or exclude properties and elements from a revision based on a condition.
ShowCount(count) = Paragraph {
"The count is "; count;
if (count > 10)
" and it's too big.";
else
Bold;
};
ShowCount(5);
ShowCount(20);
⇒ The count is 5
The count is 20 and it's too big.
Revisions with loops
[edit]for
, foreach
, do
and while
loop statements can be used in a revision to iteratively add elements.
ShowNumbers(int count) = Paragraph {
Separator: ", ";
for (int i = 0; i < count; ++i)
for (int j = 0; j < count; ++j)
i * j; // This value gets added for each pass of the inner loop
};
ShowNumbers(4);
⇒ 0, 0, 0, 0, 0, 1, 2, 3, 0, 2, 4, 6, 0, 3, 6, 9
Configurations
[edit]Nytril allows for conditional compilation of individual namespaces through a Configuration feature. This is used to create several versions of the same documents that have different global properties such as style, paper size, measurement units, language, and culture. This works directly with the publishing feature, to present each viewer with a document that is customized for their preferences.
Publishing
[edit]Nytril desktop can publish all documents, in all configurations in a variety of output formats in one step. When viewed online, the viewer is presented with a unique 'sliding-pane' interface that allows them to move easily between documents, make bookmarks, and share content with others.
- ^ "The Nytril Programming Language". www.nytril.com. 2025-06-11. Retrieved 2025-06-12.
- in-depth (not just passing mentions about the subject)
- reliable
- secondary
- independent of the subject
Make sure you add references that meet these criteria before resubmitting. Learn about mistakes to avoid when addressing this issue. If no additional references exist, the subject is not suitable for Wikipedia.