[antlr-interest] ANTLR C# Consulting Project

Sagi Shkedy sshkedy at hotmail.com
Wed Aug 1 09:11:02 PDT 2007


I need some help on an ANTLR C# project. I have very little expirence with building compiler/interpreters so am guessing it will be easier for an exprienced ANTLR user to do this in a fairly short time. Please contact me at sagis at dmipartners.com if you are interested in the project and ball park the price and time. If you have suggestions for grammer changes I am open to those as well.
Specification:
This should ball park it - I was not fully formal or consistent inthe notation but I got granular wherever I thought there might beambiguity. If you take on the project we can go over this ingreater details. All the functions can easily mapped to simple C#functions.
I want to create a compiler/expression evaluator that given a stringwill evaluate it and return a string
A. I want to allow operations on 5 different data types:
   1. Quoted Strings "Hello World"      need to be able to escape parenthesis somehow
   2. Numbers: 1 1.235653.
   3. dates: #7/7/2008# #7/7/2008 5:55PM#
   4. Boolean eg: true false
   5. List 0 or more of the preceding separated by commas encased in brackets ( ["A", "B", "C"] )
B. I want to allow the following:
   1. Basic arithmetic on the numbers + - / *  parenthesis ( () )
   2. basic Boolean logic (AND, OR , NOT, &&, ||, !)
   3. Casting (number) (string) (datetime)
   4. Shorthand if statements IIF(a, b,c) (if a is true then b otherwise c) shorthand C# would work also a?b:c
   5. comparison for date and time > = < => <= != etc.                e.g. ( #1/1/2007# > #5/1/2006#  )
   6. comparison for numbers 5 > 3 etc.
   7. comparison of string (only = and != need be implemented)
   8. String functions:
      a. + for concatenation                e.g. "hello" + " " +  "world" ==> "hello world"
      b. SUBSTRING(Source, StartLocation, NumberOfChars)                e.g. SUBSTRING("HELLO", 0, 2) ==>  "HE" maps to the C# String.Substring() function
      c. UPPER(string), LOWER(string)  PROPPER(string),                e.g. UPPER("hello") ==> "HELLO",                     LOWER("HELLO") ==> "hello",                     PROPPER("hello") ==> "Hello"
      d. bool RegExMatch(string, string)                e.g. RegExMatch("HELLO", "H[a-zA-Z]+") ==> true,                     case insensitive maps to System.Text.RegularExpressions.RegEx.IsMatch() function
      e. string RegExExract(string, string)                e.g. RegExExtract("HELLO WORLD", "H[a-zA-Z]") ==> "HE"                     case insensitive also maps to a C# function don't remember which one
      f. string Replace(string, string, string) 
   9. Date time functions:
      a. NOW() returns DateTime.Now
      b. DateAdd(string, number, date) - just like in C#
      c. DateFormat(string, date) equivalent to the ToString(string)         method of the DateTime object in C#
   10. Misc functions:
       a. In list function bool IsInList(value, List)                e.g. IsInList("PA", "PA", "CA", "NY") ==> true
       b. bool IsEmpty(string)
       c. string IfEmpty(string, string)                e.g. ifEmpty("","e") ==> "e"
I think this is it in a nutshell so a sample input would be:
    UPPER("Hello") + " " + IIF(NOW() >= #1/1/2008#, " 2008 ", " 2007 ") + " " + (string)(5+5)
would return:
    "HELLO 2007 10"
_________________________________________________________________
See what you’re getting into…before you go there.
http://newlivehotmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070801/edb62283/attachment.html 


More information about the antlr-interest mailing list