flat assembler
Message board for the users of flat assembler.

Index > Heap > Z - The Final Language + Custom IDE.

Author
Thread Post new topic Reply to topic
uart777



Joined: 17 Jan 2012
Posts: 369
uart777
Design for Z-IDE & Z, the Final Language.

Objective: A portable language+IDE for X86+ARM+Bytecode that's faster, smaller and easier to use than C/C++/VisualStudio. Logical, straight forward. Only the essentials. Modern graphics with classic appearance. Lightweight package: <1MB. Documentation, tutorials, examples.

Language would be powered by FASM edited with only one change: Uppercase IF/ELSE/END/WHILE/REPEAT/BREAK are the assembly-time directives. Lowercase "if, else if, etc" macros for runtime.

Estimated time required: Unknown, 20-30 hours. If I was being paid at 8 hours a day, I could finish this project in 3-5 days or 16-20 hours straight with enough determination and concentration. Once this is finished, I'll never have to do it again and it will be so easy to make programs & games overnight. Hopefully by Christmas (12-25-13).


Description:
Filesize: 383.82 KB
Viewed: 1962 Time(s)

Z-IDE.JPG




Last edited by uart777 on 19 Oct 2013, 03:06; edited 1 time in total
Post 19 Oct 2013, 03:03
View user's profile Send private message Reply with quote
uart777



Joined: 17 Jan 2012
Posts: 369
uart777
Z - The Final Language

Introduction to Z for beginners. Very little programming experience is assumed.
Code:
;;;;;;;;;;;;;;;;;;; INCLUSION ;;;;;;;;;;;;;;;;;;;;

"use" includes/inserts an external file (*.INC
by default) from the \INCLUDE\ folder providing
access to variables, macros and functions defined
inside of it.

use image ; include 'include\image.inc'

2+ files may be written on the same line
separated with commas:

use draw, font, image, tilemap

For Windows imports, see IMPORT.INC.

;;;;;;;;;;;;;;;;;;; VARIABLES ;;;;;;;;;;;;;;;;;;;;

"variable": a named location in memory for data
that varies: numbers, text, etc.

byte c='A'
integer age
text t='ABC', name(64)

Variables have attributes associated with them:
address, name, type, size and sign. Address is
its location.

Names may consist of letters, numbers and some
symbols (example: @!?), but must be unique
and cannot begin with a number.

Type can be integer, literal text, pointer,
special structure or dynamic array.

Size and sign determines the range of
integer types:

* US=Unsigned: 0 to ((2^XBIT)-1)
* S=Signed: -((2^XBIT)/2) to (((2^XBIT)/2)-1)

;;;;;;;;;;;;;;;;; TYPES & SIZES ;;;;;;;;;;;;;;;;;;

Primitive: Standard Objective Names (C/Java/Etc):

* u8, byte, ubyte, uchar ; 8BIT US
* i8, s8, sbyte, char    ; 8BIT S
* u16, ushort            ; 16BIT US
* i16, s16, short        ; 16BIT S
* u32, uint, uinteger    ; 32BIT US
* i32, s32, int, integer ; 32BIT S
* void                   ; Pointer: XBIT
* text                   ; Literal (UTF8/16)

* 8BIT US: 0 to 255
* 8BIT S: -128 to 127
* 16BIT US: 0 to 65535
* 16BIT S: -32768 to 32767
* 32BIT US: 0 to 4294967295
* 32BIT S: -2147483648 to 2147483647

Special Internal Structures. Some support
operators (example: a=b for string.copy(a,b)):

* variant, color, array, string, box, image

(Under Construction)

;;;;;;;;;;;;;;;;;;; OPERATIONS ;;;;;;;;;;;;;;;;;;;

. a=b      ; Copy, assign
. a+b      ; Add
. a-b      ; Subtract
. a*b      ; Multiply
. a/b      ; Divide
. a%b      ; Modulus
. a<<b     ; Shift left
. a>>b     ; Shift right
. a<>>b    ; Rotate right
. a&b      ; AND: If both. Clear BITs
. a|b      ; OR: If either. Set BITs
. a&|b     ; XOR: If different. Toggle BITs
. not(a)   ; NOT: Invert
. neg(a)   ; NEG: Negate

;;;;;;;;;;;;;;;;; IF EXPRESSIONS ;;;;;;;;;;;;;;;;;

"if" executes its block ("if...end") if the
condition is true and skips it otherwise or
proceeds to the following "else/if".

if a=b
 ; ...
end if

"if-else" chain:

if v=1
 ; ...
else if v=2
 ; ...
else if v=3
 ; ...
end

Conjunctions: and, or

if a>b or (c<>0 and i<n)
 ; ...
end

After "end", "if" is optional.

Operators:

* =    ; Equal?
* <>   ; Unequal?
* <    ; Less?
* <=   ; Less or equal?
* >    ; Greater?
* >=   ; Greater or equal?

;;;;;;;;;;;;;;;;;;;;; LOOPS ;;;;;;;;;;;;;;;;;;;;;;

"loop": a section of code that can repeat itself
a specified number of times or while or until a
condition is true. There are 4 different types
of loops - repeat, while, until and for/loop.
for/loop has the versatility of C/Java with an
easier syntax than BASIC/VB.

repeat n      ; # times
 ; ...
endr

while i<n     ; while less
 ; ...
endw

until i>=n    ; until greater or equal
 ; ...
endu

for i=0 to n  ; i++ each time
 ; ...
endl

loop i=0 to n ; for=loop, same
 ; ...
endl

loop i to n   ; =0 is optional for 0
 ; ...
endl

; assign, compare, operate

for i=0, i<n, i++
 ; ...
endl

; iterate through powers to 2 to 256MB

for i=1, i<=256*MB, i<<1
 ; ...
endl

;;;;;;;;;;;;;;;;;;; FUNCTIONS ;;;;;;;;;;;;;;;;;;;;

"function": a named, secluded section of code
that can be called/invoked into action. Functions
can accept parameters and return a value/result.

function rgb, r, g, b
 ; ...
endf

To call a function, write its name then
parameter/s (if any):

rgb 0, 0, 7Fh

(Under Construction)

;;;;;;;;;;;;;;;;;;; STRUCTURES ;;;;;;;;;;;;;;;;;;;

"structure": a collection of data/variables that
describes one logical type.

structure IMAGE
 void p
 integer x, y, w, h
 boolean key, alpha
ends ?image

(Under Construction)    
Post 19 Oct 2013, 03:06
View user's profile Send private message Reply with quote
pabloreda



Joined: 24 Jan 2007
Posts: 99
Location: Argentina
pabloreda
uart777:

Don't forget the usefull

/mod divide and get result and modulo in the same time
*/ multiply then divide

and

*>> multiply then rigth shift
<</ left shift and divide

without loss precision (64bits intermediate result)

very usefull for fixed point numbers

you can take a look to retroforth or the jupiter ace languaje, perhaps you like it.
Post 19 Oct 2013, 12:56
View user's profile Send private message Visit poster's website Reply with quote
uart777



Joined: 17 Jan 2012
Posts: 369
uart777
pablo: Your suggestions are very uncommon non-standard operations that do not correspond to instructions on any CPU. No situation requires them ever, not in billions of lines of code and they wouldn't save .0001% of the overall time it takes to make a real quality program. However, I will support standard mini expressions that resemble X86+ARM style addressing modes. Example: r1=r2+(r3<<r4)

Thanks for responding.
Post 19 Oct 2013, 17:59
View user's profile Send private message Reply with quote
pabloreda



Joined: 24 Jan 2007
Posts: 99
Location: Argentina
pabloreda
ok, only for reference
in x86 this is my implement of

Code:
*/
        "cdq" 
        "imul dword [esi]" 
        "idiv ecx" 

*>>
        "cdq" 
        "imul dword [esi]" 
        "shrd eax,edx,cl"

<</
        "cdq" 
        "shld edx,eax,cl" 
        "shl eax,cl" 
        "idiv ebx"
    
Post 19 Oct 2013, 20:08
View user's profile Send private message Visit poster's website Reply with quote
uart777



Joined: 17 Jan 2012
Posts: 369
uart777
Those operations are supported by every language that I've contributed. They would be divided into 2 operations. Example: Multiply then add/accumulate (for arrays of structures) can be written as: . r1=r2*r3+r4 (new Z-style) OR . r1=r2, r1*r3, r1+r4 (old Z77 way, before it evolved), and this is one instruction in ARM: mla r1, r2, r3, r4. Z will take advantage of special addressing modes. Examples: . r1=r2+r3*4, r1=r2|(r3<<r4) (for both X86+ARM).

Users can customize the language 100%. You can write macros to support those symbols just to clarify your FP library. Z = F/ASM+macros with only one change: if/else/etc=runtime and IF/ELSE/ETC=assembly-time directives.
Post 19 Oct 2013, 22:15
View user's profile Send private message Reply with quote
uart777



Joined: 17 Jan 2012
Posts: 369
uart777
Z-IDE looks AMAZING on my cell phone zoomed in with Opera Mobile Classic! Smile Maybe someday it will be on the Android Store, a portable universal assembler+compiler for all CPUs.
Post 19 Oct 2013, 22:21
View user's profile Send private message Reply with quote
uart777



Joined: 17 Jan 2012
Posts: 369
uart777
Improved design. Much cleaner and tighter. Help menu.

What programs do I use to design software? - Office/document: Microsoft Publisher and Open Office.


Description:
Filesize: 458.28 KB
Viewed: 1823 Time(s)

Z-IDE.jpg


Post 20 Oct 2013, 21:54
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.