Login to TechLifeForum X
Board Index Go to Reboot.Pro
  • Account Login
  • Register
TechLifeForum
  • Home
  • Members
  • Awards
  • Rules
  • Help
  • Donate
  • Live IRC
TechLifeForum / Programming and Development / .Net Framework Programming v
« Previous 1 ... 9 10 11 12 13 ... 46 Next »
/  TLF# : A TLF programming language (well not quite)[Advanced Search]
Reply to thread
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[C#] TLF# : A TLF programming language (well not quite)

05-04-2012, 04:31 PM
Post: #1
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
TLF# : A TLF programming language (well not quite)
So, I will probably have to put this on my WishList, but I hope to eventually have time to pursue creating a simple language in depth. Currently all I've done is taken rules set by me and converted the code to C#.

Later if I decided to pursue it, it'd be a bit more technical, but I'd most likely use Mono or dive into something like this:
http://msdn.microsoft.com/en-us/magazine/cc136756.aspx

Any who, here's a pic of what I was playing around with. It's real simple, but could easily be expanded with a few more rules and logic.
   

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
05-04-2012, 04:35 PM
Post: #2
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
RE: TLF# : A TLF programming language (well not quite)
After looking at the screen shot, you'd think I just did a .Replace on the code... Lol. Here is a snippet to show otherwise:

Code: (SELECT ALL CODE)
private void Process()
{
    Token token = _processor.GetToken();
    Token oldToken = new Token(TokenParser.Tokens.UNDEFINED, "");
    string sReturn = "";
    while (token != null)
    {
        switch (token.TokenName)
        {
            case (TokenParser.Tokens.StartSub):
                {
                    sReturn += "private void";
                    break;
                }
            case (TokenParser.Tokens.EndSub):
                {
                    sReturn += "}";
                    break;
                }
            case (TokenParser.Tokens.WHITESPACE):
                {
                    sReturn += " ";
                    break;
                }
            case (TokenParser.Tokens.LPAREN):
                {
                    sReturn += "(";
                    break;
                }
            case (TokenParser.Tokens.RPAREN):
                {
                    if (_processor.Peek().TokenPeek.TokenName == TokenParser.Tokens.SEMI)
                        sReturn += ")";
                    else
                        sReturn += ")\r\n{";
                    break;
                }
            case (TokenParser.Tokens.NewInt):
                {
                    sReturn += "int";
                    break;
                }
            case (TokenParser.Tokens.INTEGER):
                {
                    sReturn += token.TokenValue;
                    break;
                }
            case (TokenParser.Tokens.STRING):
                {
                    sReturn += token.TokenValue;
                    break;
                }
            case (TokenParser.Tokens.PLUS):
                {
                    sReturn += "+";
                    break;
                }
            case (TokenParser.Tokens.EQUALS):
                {
                    sReturn += "=";
                    break;
                }
            case (TokenParser.Tokens.IDENTIFIER):
                {
                    sReturn += token.TokenValue;
                    break;
                }
            case (TokenParser.Tokens.NEWLINE):
                {
                    if (sReturn.IndexOf("{") != sReturn.Length - 1)
                        sReturn += ";\r\n";
                    else
                        sReturn += "\r\n";
                    break;
                }
            case(TokenParser.Tokens.Display):
                {
                    sReturn += "Console.WriteLine";
                    break;
                }

        }
        oldToken = token;
        token = _processor.GetToken();
    }
    rtbOutput.Text = sReturn;
}

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
05-04-2012, 04:49 PM
Post: #3
m0ral Offline
Why so Serious...?
****
Posts: 567
Joined: Jun 2011
Reputation: 13
First 25PhilosopherSpam Protection
RE: TLF# : A TLF programming language (well not quite)
Really, this can become awesome, though there is one thing that I don't like (actually make it 2)...
First is, it looks way too much like (Visual)Basic, second it's to long....

Start Sub => private void/int/string/etc...
why not make it "c++ like", int => public int, ~int => private, -int protect... I know it's not really creative, but I just mean why not make it "shorter"... and less VB ;)

All in all however, it's interesting to see what you'll do with it :D

Why so Serious??? Play League of Legends with me...
Find
Reply
05-04-2012, 05:10 PM (This post was last modified: 05-04-2012 05:11 PM by KoBE.)
Post: #4
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
RE: TLF# : A TLF programming language (well not quite)
Eh, I was simply trying out different stuff. I don't mean for this to look like any language in particular.

I don't have a plan for syntax at all. I just wanted to test out some parsing/lexing.

If I were to pursue this further, I'd take a close look at what the syntax an stuff would or should be like.

Since it'd obviously be simple, at least at first, I thought it'd be neat to make a gap between experience programming and novice. Letting them use TLF# to learn the basics. We'll see. I do also like your idea of it being shorter. So, might go that route too. Either way it'd be a while before I'd be able to devote time to this.

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
05-04-2012, 07:22 PM
Post: #5
AceInfinity Offline
∞ IҊϜIɴITϵ ☭
*****
Microsoft MVP
Posts: 8,696
Joined: Jun 2011
Reputation: 61
RE: TLF# : A TLF programming language (well not quite)
lol, looks like something of a simplistic Visual Basic, or advanced Small Basic to me haha



Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer


Development Site: aceinfinity.net
WWW Find
Reply
05-04-2012, 09:16 PM
Post: #6
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
RE: TLF# : A TLF programming language (well not quite)
Haha, yeah. Don't mind the syntax I used.. I could have used ANY. That's just what came to my head when I was playing around.

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
05-04-2012, 10:08 PM
Post: #7
AceInfinity Offline
∞ IҊϜIɴITϵ ☭
*****
Microsoft MVP
Posts: 8,696
Joined: Jun 2011
Reputation: 61
RE: TLF# : A TLF programming language (well not quite)
Syntax doesn't really matter, as long as it's simple to remember and you don't have conflictions, and you've got a nice parsing system to convert.



Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer


Development Site: aceinfinity.net
WWW Find
Reply
11-15-2012, 07:10 AM
Post: #8
kerplunk Offline
Legen.. *wait for it* ..dary!
***
Posts: 259
Joined: Dec 2011
Reputation: 1
RE: TLF# : A TLF programming language (well not quite)
What type of object is TokenParser? Is it an enum?
And what does the Token class contain?

Browsing through threads and was somehow intrigued by this one :)
Find
Reply
11-15-2012, 02:02 PM
Post: #9
KoBE Offline
¯\_(ツ)_/¯
*******
Administrators
Posts: 4,197
Joined: Jun 2011
Reputation: 47
RE: TLF# : A TLF programming language (well not quite)
Unfortunelty, I lost this project with my others a few months ago..

The tokens type were identified by an enum similar to this
Code: (SELECT ALL CODE)
public enum Tokens
{
    UNDEFINED = 0,
    START SUB=1,
    END SUB=2,
    DISPLAY=3
}

And they were added to a dictionary of type Token, string.. with the string being the regex pattern to determine the type of token

Code: (SELECT ALL CODE)
private readonly Dictionary<Tokens, string> _tokens;

Tokens were added like so:
Code: (SELECT ALL CODE)
_tokens.Add(Tokens.START SUB, "[Ss][Tt][Aa][Rr][Tt][ \\t][Ss][Uu][Bb][^\\r\\n]*");

TokenParser was the class that I used to keep track and parse the tokens. It contained the enum similar code to what I showed above.

-> TechLifeForum on Facebook<- 
-> TechLifeForum on YouTube<-
-> TechLifeForum on Twitter<-

Tech.Reboot.Pro
WWW Find
Reply
Reply to thread


Possibly Related Threads...

Thread: Author Replies: Views: Last Post
   Open Source Dynamic Language Runtime - DLR AceInfinity 5 138 05-24-2013 12:20 AM
Last Post: _HAWK_
   Parallel Programming in C# 4 KoBE 3 232 03-07-2013 06:54 PM
Last Post: AceInfinity
   C# - Official Programming Language of 2012! AceInfinity 4 284 01-08-2013 05:52 AM
Last Post: Adriana
  Have A Little Fun With Programming Achievements! AceInfinity 11 710 08-05-2012 11:42 AM
Last Post: KoBE
  Need help with a software and programming language Logistick 1 234 06-22-2012 09:07 AM
Last Post: KoBE

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


Users browsing this thread
1 Guest(s)
Youtube Facebook Twitter Digg
Return to Top
All content © copyright TechLifeForum
Powered By MyBB, © 2002-2013 MyBB Group
Designed by ThemeFreak
Mobile Version