What would you want in a programming language?

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Post by 01000101 »

I just checked out the PMODE example in C-- and it does infact have much of what I desired lol. weird, I had never even heard of it.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

All you need is fasm and you can use the very powerfull macro.
Example1. here is a simple example of turning fasm code into a quick and dirty Qbasic:
Use these macro

Code: Select all

macro PRINT String{

        local .Printer
        local .Nextchar
        local .Done
        local .a

        .Printer:
                mov si, .a
                mov ah, 0Eh
                jmp .Nextchar

        .Nextchar:
                lodsb
                or al, al
                jz .Done
                int 10h
                jmp .Nextchar
                jmp .Done

        .a db String,10,13,0

        .Done:
}  

macro SCREEN mode
{
	push ax

	if mode = 0
		mov ah,0h		;SCREEN 0; Default DOS screen mode
		mov al,3h
		int 10h
	else if mode = 13
		mov ah,0h		;SCREEN 13; VGA
		mov al,13h
		int 10h
	end if

	pop ax
}

macro SLEEP
{
	;Output:
	;ah = BIOS scancode of key pressed
	;al = ASCII character of key pressed
	;Could have also used...
	;	mov ah,8h
	;	int 21h
	mov ah,0h
	int 16h
}

macro END
{
	mov ax,4Ch	;\END
	int 21h		;/
}

macro LOCATE row,col
{
	pusha

	mov ah,2		;Function 2
	mov bh,0		;Use page 0
	mov dh,row	;row
	mov dl,col		;col
	int 10h

	popa
}
And then you can do this:

Code: Select all

	SCREEN 0
	COLOR 33
	LOCATE 5,5
	PRINT "Hello World"
	SLEEP
	END
Example2.
Or using a macro like case

Code: Select all

macro case op1,op2
	{
	cmp  byte [edx],op1
	je   op2
	}
you can do this:

Code: Select all

;;---------------------------------------------------------;;
;;  - Solidus117
;;		Team DexOS
;; Interpret                                              
;;   Interpret the Brainfuck source, acting upon the VMM  
;;---------------------------------------------------------;;
	Interpret:
		mov  edx,loadpoint-1
		mov  ebx,memory

	lp:	inc  edx
		case '+',incval
		case '-',decval
		case '>',incptr
		case '<',decptr
		case '.',putval
		case ',',getval
		case '[',tstjmp
		case ']',uncjmp
		case 00h,@f
		jmp  lp
	@@:	ret
With the aid of some good macro, you can have your low and HLL language,its is call FASM.
User avatar
~
Member
Member
Posts: 1226
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Post by ~ »

SpooK wrote:Such a desired language already exists, it is called C-- :idea:

But from the C-- syntax/reference manual:

Code: Select all

  ... constant expressions are always calculated
  from left to right, contrary to the usual rules of arithmetic. This is
  unlike the situation in other computer languages, and you must be careful
  when writing expressions to remember that 2+3*2 equals 10 and not 8.
Wouldn't performing, for 2+3*2, performing in a non-standard way, plainly from left to right, (2+3)=5 and then (5*2)=10, instead of correctly (3*2)=6 and then (2+6)=8, become a considerable standarization drawback?

Considering that in that case, probably there's no standard defined operator precedence and then things will be calculated depending on the operators used in an expression, as they appear, from left to right, and that would force to re-code to reorder the set-up of a finished algorithm back and forth whenever expressions are concerned?
YouTube:
http://youtube.com/@AltComp126

My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

So use parentheses. They're in the lexeme, so they're there to be used.


* I have written a C-- parser as part of a lecture. I'll be making the code generator next year. Everything just seems so easy after working in industry for a year :(
User avatar
~
Member
Member
Posts: 1226
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Post by ~ »

JamesM wrote:So use parentheses. They're in the lexeme, so they're there to be used.
So, if such a way of solving expresions through a relatively simplified and non-standard interpreter and therefore, if producing a non-standard result is perfectly acceptable, it's safe to assume that in spite of anything else, such a product would be far more acceptable if it would solve expressions in a standard way without requiring nestings or groupings for getting it?
YouTube:
http://youtube.com/@AltComp126

My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Post by 01000101 »

the fact that the expressions are taken from left to right is really odd. I don't like that at all, its almost like they didn't want to put the effort into making the math processing CORRECT.
SpooK
Member
Member
Posts: 260
Joined: Sun Jun 18, 2006 7:21 pm

Post by SpooK »

01000101 wrote:the fact that the expressions are taken from left to right is really odd. I don't like that at all, its almost like they didn't want to put the effort into making the math processing CORRECT.
Well, that would involve much less effort than trying to write such a desired language from scratch. Even if you had to develop a stand-alone numeric preprocessor, C-- already covers the rest.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

There is a precedent. Smalltalk also processes all binary operators from left to right, mainly because all operators are conceptually just messages. It pretty much makes parentheses in arithmetic expressions a requirement.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

As does LISP, and all LISP based languages. LISP doesn't have infix operators at all, you have to define everything in a sort of reverse polish notation:

Code: Select all

(+ 4 (* a b) 5) = 4+ a*b + 5
Also, instead of bitching about a language that was quite specifically dumbed down from a parsing perspective, try looking, and you'll find it's bigger cousin, C-. C- Builds on C-- in a couple of areas, specifically operator precedence.
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Post by 01000101 »

I'm not bitching about it, I don't even use it.. nor am I looking for languages, therefore I was not seeking its big cousin in the first place.

so lets see, there's C++,C,C-,C--.... any others?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

My imaginary OS-dev language would feature:
- no single dependency on a runtime. (like assembler, C)
- inline assembly (both turbo C style (compiler preserves the necessary stuff) or GCC style (programmer specifies in/out/clobber) )
- user-defined width variables (not restricted to powers of two, or above 8)
- native support for platform features (think: segmentation, vector instructions, atomic operations)
- a subset that is strictly cross-platform
- function pointers
- macros
- function and operator overloading (as in Haskell, new combinations of characters included)
- structs and typedefs (C style), enumerations (VB style), datatypes (haskell style)
- object-oriented programming
- customizable calling conventions
- aspect-oriented programming (powerful enough to implement garbage collection and have each defined class use that automatically)
- templates
- strong typing
For the geeks among us:
- a LL(1) grammar
The compiler:
- loads of semantic checks
- a -Werror flag
And on the far end of the wish list...
- header file generation
- dependency generation
- template and aspect export :twisted:
- hash generation
- split array definition (where the linker will concatenate arrays defined over multiple object files)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Post by DeletedAccount »

Some people say that a language should only allow minimal amount of constructs so that it is easier to design the language as well as learn the language . Their viewpoint is , more features you have , far easier it becomes to write unreadable code . Btw the recent trend is squeeze lots of features into a single language so that it becomes unmaintainable afterall ... But this approch has its weakness ....
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Post by JackScott »

That might be the difference between languages say, like Ada, where EVERYTHING was a part of the language, and Java, where most of the language specification is in the library, which you don't have to use all of if you don't want.

My current opinion is that if you have third-party libraries to do stuff that could be made standard, then you are just inviting code incompatibility and rewriting. So I think what would be best would be using an 'external' standard library: it provides everything the programmer would want to use, but they don't have to use it, and it can be taken away to give just the core language.
User avatar
Zacariaz
Member
Member
Posts: 1069
Joined: Tue May 22, 2007 2:36 pm
Contact:

Post by Zacariaz »

Now what would I want from a Programming language...
audiotory programming: "computer, make me a program that does this and that...." :lol:
This was supposed to be a cool signature...
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Post by JackScott »

We can only hope.

One thing I like about newer languages (in general) as opposed to older ones (within the C family) is that they don't require header files. I hate header files. Java doesn't need them, and it saves so much time. You just need a smart compiler/linker.
Post Reply