I'm developing my own scripting language to solve some unique challenges for a project.
The language takes source code and converts the contents into tokens, and then a command factory is used to convert those tokens into something that can be executed.
An example of a script might look like this.
accept: always;
reject: title has "something" or body has "something else";
reject: title length < 10;
Each line in the script ends with a ;
terminator, and each line starts with a named rule that ends with :
. Each rule uses a command followed by arguments. The commands can be joined together using logical operators. The number of arguments a command can have is fixed. So when I find a command I can expect X number of additional tokens for the syntax to be correct. The goal is human readable code because non-programmers will be using it.
An alternative way of writing the same above code using a C style structure would be.
accept(true);
reject(has(title,"something") || has(body,"something else"));
reject(length(title) < 10);
What is the term used for a parser that handles a language where ()
for structuring arguments is omitted, and there are no clear boundaries defined for arguments.
I would like to read up on how these kinds of parsers are implemented. To ensure I'm not overly reinventing the wheel or running into common problems.
title length < 10
? Also, you may need parentheses after all for grouping conditions. When you've sorted that out, a standard LR parser should to the job.title length < 10
is the same asstrlen(title) < 10
in most languages wheretitle
is a string variable.