Click here to Skip to main content
13,152,321 members (40,089 online)
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 30 Aug 2011

SCLOG: one more bicycle that has all signs of programming language

, 30 Aug 2011
Rate this:
Please Sign up or sign in to vote.
A way to view, store and process logical expressions

When we reached the point to develop user defined actions and filters our interface designer Michael hung. He was thoughtfully staring at the window and smoking one after another, from time to time he started thrashing the punching bag shouting something obscene. Actually, he had non-trivial task: at the last planning meeting it was stated that forcing users create rules in plaintext manner is not user-friendly and non-intuitive.

When the third day came, Michael shouted: "Bingo! We’ll have a tree!" The idea was quite simple: display a logical rule as a tree where brunches represent logical "and" or "or" and leaves represent some logical conditions. The command liked the idea, and he started "creating". For several days he stared at monitor knocking keyboard muttering something obscene. Once he asked me how we were going to store the tree, I was deep in optimizing SQL-queries and said without actual thinking: "In the string, of course."

And finally I was staring at this:

&( s_!=~( city , " Saint- " ) , s_=( platform , " Linux " ) , i_>( screenw , 1024 ) , i_>( screenh , 800 ) , |( i_>( viewed , 7 ) , i_>=( timeonsite , 30 ) ) )

Representing the following tree:

old tree-builder

After having look at this string, I told myself: "It looks like a program directive." So, some experiments and test were done and it was found out to be reasonable just to make an interpreter for this language. We’ve called it "scisp" at a very start because of many brackets, but after some thinking we decide that it deals more with logic than with lists, and the language got it final name "SCLOG."

Now SCLOG has two data types ("string" and "integer"), two logical operations ("and" and "or") , four string comparisons ("equal", "not equal", "contains", "not contains"), six integer comparisons ("equal", "not equal", "less", "greater", "less or equal", "greater or equal"), visual tree-building tool written with jQuery for web and php-interpreter.

The string shown upper, has the following form:

&(!~(city,"Saint-"),=(platform ,"Linux"),>(screenw,1024),>(screenh,800),|(>(viewed,7),>=(timeonsite,30)))

Useless spaces gone and operators got more reasonable representations, and the tree visual representation evaluated to the following completely editable with CSS:


What's next:

  • New data types: boolean, datetime, float and arrays;

  • C# interpreter.



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Alexander Kouznetsov
Chief Technology Officer netrox (sc)
Russian Federation Russian Federation
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...


Comments and Discussions

GeneralInteresting story. Pin
Walt Fair, Jr.31-Aug-11 8:27
subeditorWalt Fair, Jr.31-Aug-11 8:27 
GeneralRe: Thanx Pin
Alexander Kouznetsov31-Aug-11 19:36
memberAlexander Kouznetsov31-Aug-11 19:36 
GeneralReason for my vote of 5 good job Pin
Manimal9930-Aug-11 7:09
memberManimal9930-Aug-11 7:09 
GeneralRe: Thanx Pin
Alexander Kouznetsov31-Aug-11 19:36
memberAlexander Kouznetsov31-Aug-11 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170924.2 | Last Updated 30 Aug 2011
Article Copyright 2011 by Alexander Kouznetsov
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid