Jump to content
Science Forums

Programmed Software Language


pljames

Recommended Posts

I loved Basic. Tried others but got addicted to Basic then created my own personal language called GOAL or goal orientated active language. But am confused using colons and semicolons. Would like to use colons as a compiler: and semi-colons; as a complied instruction. Like :list#s 1toten; the instruction is between the colon and semi-colon.

Is that possible? pljames

Link to comment
Share on other sites

  • 5 months later...
  • 2 months later...

It's certainly possible and the parser should be relatively simple (at least until you add other constraints). At the end of the day you are trying to create an "Abstract Syntax Tree" which is readily 'understood' by the compiler. Providing prefix and suffix notation actually makes this easier, at least until you have to parse data that contain the same marks.

 

 

While it takes a while to 'get' you might want to look into Lisp programming - it would allow you to create the parser you desire, as well as give you more insight into what you wish to do.

 

Edit: that was poorly stated. You could create the parser you desire in basic, but it is more elemental in Lisp, which is what I was trying to convey,

 

GsT

Edited by GeneT
Link to comment
Share on other sites

  • 6 months later...

It goes like this,

 

lIST 1-10: (remarks)

              :CLEAR SCREEN;

              :LIST;

                       :END

                  OR

List 1-10:

              :clear screen; :list;

                                          :End

 

Anything left of the colon is the name of the program.

The () are the remarks if necassary.

Between the colon and semicolon is the instruction.

The ; is the complier.

Anything right after the : is the end (or run sequence).

The name of the language is, Goal or Goal object active language. Thoughts? Paul

            

Link to comment
Share on other sites

Took the liberty of moving this thread to computer science, although Basic ets. is a language, I think this topic concerns more programming. It might also increase the anmount answers you get.

Sactus,

           Is it possible to create Goal as a programming language just for me alone? Does it have possibilities to work and what language could I use to use it beside basic? Paul

Link to comment
Share on other sites

Whenever I hear of someone wanting to create a new programming language, I'm always reminded of the misquoted dictum: "God must love religion, he created so many of them!"

 

Before you create one, you should definitely ask yourself why you want to do so. There's no question that each computer language that exists was created to fill some hole that previous languages failed to solve. But while many languages build on previous ones (e.g. C++, C#, Javascript and Java are all based on C), so many have decided they needed to create a completely new language from scratch without a really decent excuse for it (e.g. [buffy puts on flame suit] Ruby, PHP, python [/flame suit]). Now that they're here and popular, fine. But those designers took a big risk in starting from scratch and it's amazing how the "older" languages seem to catch up if they're popular (e.g. C# adding named and optional parameters that were one of the excuses for Ruby). No one is going to know your language; no one is going to want to take over or fix your code; even using it yourself will be hard because getting compilers to the point where they work fairly reliably takes a long time; the list of downsides is endless. Quite a Sisyphean task.

 

Now apropos of all of that, as a trained expert in programming languages, I've personally created dozens of them. The best excuse is if they are *not* general purpose programming languages but rather limited to a very small problem set. Most of mine have had to do with dealing with parallel processing and event driven UI models, but there are all kinds of problems out there where you can come up with a more concise or intuitive (both subjective judgments) ways of expressing a solution to a problem, so if you've got one, certainly go ahead.

 

Now while I do this kind of stuff in my sleep, most people consider compiler writing a brain twisting task. While we oldsters usually plow through using lex and yacc (or open source versions Flex and Bison) lexical analysis and parser generators, I generally recommend folks that are new to this take a look at the GOLD Parser generator, or  ANTLR, but there are dozens of Compiler Generators out there to choose from.

 

It is not for the faint of heart.

 

To get to your specific question, the distinction between what a "lexical analyzer" is versus a "Parser" is critical. The former takes a stream of characters and then turns them in to a sequence of logical "tokens" that have specific meanings. The Parser then constructs a "tree" or network out of those tokens to try to put together a translation of the logical concepts in your program into the machine code (or intermediate code) that actually gets executed by the computer. So you can use a colon or a semi-colon or a dollar sign or an exclamation point to be anything you want at the "lexical" level, at that point though, you need to decide what they mean as a "logical token." It would seem that you are using colon as the end of a "label" that can be invoked and the instructions continue after invoking that until it gets to a semicolon which represents the end of the "function" (or "program" as you're referring to it). C does this by having the "label" be a "function" and the function name is followed by a "{" then instructions, then a "}". Pascal uses the full words "begin" and "end" Lisp uses an "exec list." So, every language uses different sequences of characters to define meaningful tokens. But quite frankly you can write your lexical analyzer to use any sequence of characters you want. For a really crazy extreme that this can be taken to, check out the Whitespace programming language....

 

The parser is a step beyond what you've described here and deals with creating a structure and sequences and interpretation of the inputs and creating outputs once you've "parsed" the code as you would a sentence in a natural language like English. The lexical analyzer gets you from letters to words, and the parser gets you from words to sentences and paragraphs. That's where you deal with loops and processing math, and doing different things depending on the program inputs.

 

 

Man invented language to satisfy his deep need to complain, :phones:

Buffy

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...