Jump to content

Custom programming language - feedback


Ramzes
 Share

Recommended Posts

I am programming for a long time in many scripting and programming languages and I decided to do my custom. It will based on Assembly, C++ and AutoIt (and maybe also on others). Forum has a lot of experienced programmers. I hope they will help me.

First I want to write a code syntax. I'm open to your suggestions.

Here is a list of basic elements:

1. Main function:
2. Variables and arrays:
3. Functions and parameters:
4. Keywords:
a) If...ElseIf: Switch Case:
c) Select Case:
5. Loops
a) For: While:
c)Do While:
6. Labels:
7. Comments:
8. Pointers:
9. Operator:
10. Macors:
11. Object-oriented programming:

Please post your ideas. Below is example feedback.

1. Main function:
No. I don't like stiff schemas.
2. Variables and arrays:
No division for global, local and constants. You set only size, e.g.
dword $Var1 = 1025
byte $Text = "Your text" (ASM style)
Array (compiler will assume a size of an array)
word $Array[] = [11, 4, -9]
3. Functions and parameters:
Autoit style
4. Keywords:
a) If...ElseIf:
Autoit style Switch Case:
Autoit style
c) Select Case:
Autoit style
5. Loops
a) For:
For ($i = 3, $i >= 10; $i += 2)
...
Next While:
While ($Val >= 3)
...
WEnd
c)Do While:
Do
...
Until
6. Labels:
@Lab3
7. Comments:
; one-line
/*
multi-line
*/
8. Pointers:
[$MessageBox]
9. Operator:
C++ stlye (~a, a & b, a << b, etc.)
10. Macors:
#DesktopHeight
11. Object-oriented programming:
With $oIE
refresh
navigate("google.pl")
EndWith

Edited by Ramzes

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Link to comment
Share on other sites

Have you decided whether it should be interpreted / compiled language? Whether it should be statically and strongly typed or not? How about types, any structure / class related? These are probably most important to decide firstly, because they tend to shape the language a lot.

How about blocks? I tend to think {} looks less clumsy than a lot of End****, will also reduce parser. The plain english keywords also collide with the more cryptic binary operators, c++ bring. You should probably choose one. You also seem to mix in some different syntax, some keywords require () around the expression, while others dont.

Really reconsider scoping.

Edited by Shaggi

Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG

Link to comment
Share on other sites

11. Object-oriented programming:

With $oIE

refresh

navigate("google.pl")

EndWith

I think you have a lot to learn. Please go look at other languages and what makes them great.

Sounds like you are a real novice, like, maximum 2 years experience in programming. Wait 2 more years, or 4 years. Learn many languages, always write your own languages for fun, then make a real one.

Link to comment
Share on other sites

It's a big job. I'm doing it at the moment. I'm going for a different language though. You can look at the very messy and incomplete C source code here. I also have an alternative hand written lexer in assembly hanging around somewhere...

I would definitely take a look at Pratt's Top Down Operator Precedence Parser. I wrote a post about it with nice C examples. I wrote a more extensive blog post about it here.

I'd also get hold of the dragon book. Read the sections on lexical analysis and parsing and see what you understand. Then read it again until you do understand it :D

Look at the tools. My advice is not to write it by hand. Trust me I've been there. I had to because AAL (the language I am working on) is a school project so I needed to show I understood the principles. Ragel is brilliant. Very easy to use and outputs diagrams to boot (these usually take a bit of editing in notepad first though as they can be messy). The only problem is that code is unreadable. Put it in a file, and never read it. Other tools like yacc and bison I haven't used, but they are explained nicely in the dragon book.

Plan the syntax carefully. That doesn't mean write a standard, because they are pointless when you are the only one implementing it. What it means is that you should actually write some programs in the language that you'd expect to work, then read them back. Until you plan it you are leaving yourself open to all kinds of problems with ambiguity etc. Once you've written some examples it will be clear what will work and what won't.

Edit: And listen to Manadar. Don't implement features you don't understand :oops:

Edited by Mat
Link to comment
Share on other sites

Thank you for advices. This last one is the best. :D

I'll start from displaying "Hello World". In future may I publish my work. But where? I think AutoIt Forum isn't good place for my project. Creating new website with message board will takes a lot of time and money.

Now I need your feedback about code syntax (keywords, variables, operators and etc.).

If you want to joint to me - PM me.

Edited by Ramzes

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Link to comment
Share on other sites

Publish work on sourceforge... It's free. For a website then use sourceforge and wordpress. It's free. Don't worry about a message board until you have a community. If people want help they can email you, Once the emails get too much set up a forum, but not until then.

Can you write the solutions to the first 5 projecteuler problems in your language?

Link to comment
Share on other sites

I second Mat, particularly about the dragon book (any color will be a good start anyway).

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Oh, I know SourceForge. It is good and popular website for projects. Maybe in the future I will publish my work them.

Time is money so I back to writing.

PS: I attach my "Hello World" program.

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Link to comment
Share on other sites

I was really annoyed when I bought one second hand off ebay... My edition didn't actually have a dragon on it.

The version I had from the library whilst writing Ceres was the second edition and had a dragon on it :D

The amount of times I read about context-free grammars was insane. That book isn't light reading.

Link to comment
Share on other sites

Certainly not the funniest/simplest reading but I hardly see how you can seriously embark in such boat without having chewed the concepts it discusses. I mean you can start without but unless you already have enough theory behind you, you're going to hit walls you won"t know how to circumvent efficiently.

Looks like a dead end as is: good will can't suffice.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...