atarionline.pl ATALAN - new programming language - Forum Atarum

Jeśli chcesz wziąć udział w dyskusjach na forum - zaloguj się. Jeżeli nie masz loginu - poproś o członkostwo.

  • :
  • :

Vanilla 1.1.4 jest produktem Lussumo. Więcej informacji: Dokumentacja, Forum.

    • 1: CommentAuthorrudla
    • CommentTime13 Feb 2010 zmieniony
     
    Hello,

    I would like to introduce new programming language for Atari (and maybe C64 too :-) I am developing.

    You can see website ->link<-
    Small (working) example can be found at
    ->link<-

    Maybe some graphic will want to provide logo for the language?
    • 2:
       
      CommentAuthorKaz
    • CommentTime13 Feb 2010
     
    Wow!

    Atalan is new high level programming language for MOS Technology 6502 microprocessors. It is meant to be used for development on 8bit computers like Atari 800, C64 etc.

    Atalan is work in progress, it can however already generate working code.

    Atalan is cross-platform development system. Compiler runs on desktop machine (currently Windows, but it is developen just using ANSI C, so orting should be straightforward).

    It generates source code for 6502 assembler (MADS). It does not however use any special features, so other assemblers coule be used too.
    • 3: CommentAuthorrudla
    • CommentTime13 Feb 2010 zmieniony
     
    And I forgot to add, that I'm open for suggestions from coders about their language dream features :-)
    • 4: CommentAuthormono
    • CommentTime13 Feb 2010
     
    What are your design goals? Could you expose any advantages (or disadvantages) comparing to another languages for example Action!, cc65, asm? For a first view it looks like an Action!
    • 5: CommentAuthorrudla
    • CommentTime13 Feb 2010
     
    Action! is of course major inspiration for ATALAN.

    Major advantage over Action! should be better quality of produced code, availability, and being actively developed.

    cc65: I believe Atalan will have much nicer syntax than C.

    asm: Allows better code, but development is slow. Also for novices, it is scary. I believe Atari may get more coders when equipped with appropriate language.

    I have some very nice features like time measured loops (no longer than 10s while x) etc. to make game development easier.

    Some prepared modules would be very nice (like software sprites, scrolling playfield etc.)

    Apart from making the language very pleasant to use, I envision platform independent library, that would allow development of software for both Atari and C64. I believe games like KOLONY 2106 are good candidates for this.
    This may bring the communities closer together.
    • 6: CommentAuthorrudla
    • CommentTime13 Feb 2010
     
    Oh, and feel free to write in Polish, I can read it.
    • 7: CommentAuthormarok
    • CommentTime13 Feb 2010
     
    Ja tylko z taka ogolna opinia. Wydaje mi sie, ze to moze okazac sie bardzo wartosciowe narzedzie.

    Ciekaw jestem jak wypadna testy porownawcze z cc65 i action!. Mam na mysli szczegolnie wynik kompilacji porownywalnego kodu we wszystkich tych jezykach.
    • 8:
       
      CommentAuthorKaz
    • CommentTime13 Feb 2010
     
    Did you think about co-operation with Gury (his Effectus seems to be nice)?
    • 9: CommentAuthorrudla
    • CommentTime13 Feb 2010
     
    Yes I did. I'm definitely going to open the source code.
    • 10: CommentAuthorrudla
    • CommentTime15 Feb 2010
     
    I have added download section to Atalan pages, so whoever feels adventurous may try it :-)

    Currently only 8-bit arithmetic is working and lot of features must be added, but it is possible to compile simple testing program included.

    MADS is necessary to compile resulting asm source code.
    • 11: CommentAuthorw1k
    • CommentTime14 Apr 2010
     
    kedy bude nova verzia? :)
    • 12:
       
      CommentAuthorjhusak
    • CommentTime18 Apr 2010
     
    Hej. W pierwszych słowach mojego postu chciałbym wyrazić podziw i gratulacje z powodu OGROMU prac wykonanych zarówno nad językiem atalan jak i effectus. Kierunek słuszny!

    Zaglądałem do kodu źródłowego.

    Wymądrzałem się na WSZY.

    Ludzie! korzystajcie z bisona i flexa!
    Te narzędzia służą do pisania kompilatorów/translatorów/interpreterów w kilka dni!

    Dni!

    Oszczędzają miesięcy testów!

    Działają zgodnie z zasadą: nie powtarzaj się!

    Prosty translator można machnąć w godzinkę!

    Kalkulator obliczający wyrażenia typu (-23+40)*65-700/65 pisze się jakieś 15 minut!

    MINUT!

    Trochę teorii o gramatykach i wszystkie kompilatory wasze!

    W sieci mnóstwo tutoriali!

    Sam z ciekawości wrzuciłem gramatykę action do bisona (tak jest w Action language reference na końcu) i w wolnych chwilach cosik klepię. Jakąś godzinkę na tydzień.

    Jakem informatyk, daję dobrą radę: lepiej myśleć tydzień i napisać coś w 5 minut, niż myśleć 5 minut i męczyć się tydzień.

    Uff, ale się wymądrzyłem. Po prostu nie mogę patrzeć, jak zapał idzie w gwizdek.
    • 13: CommentAuthormono
    • CommentTime18 Apr 2010
     
    Potwierdzam. Dla piszących w javie można polecić antlr (albo javacc; jest też jb - translator kodu c/c++ wygnerowanego przez bisona choć dawno już nie rozwijany).
    Poza tym w niektórych zastosowaniach warto znać smc i teorię maszyny stanów. Baaaaardzo to ułatwia nanoszenie poprawek w modelu.
    • 14:
       
      CommentAuthorCosi
    • CommentTime19 Apr 2010
     
    Można też korzystać z yacc'a, ale i tak największa radocha jest, kiedy robi się to samodzielnie. Dawno temu napisałem w ten sposób własny kompilator w TP - ale potem dumny chodziłem... ;-)
    • 15: CommentAuthorrudla
    • CommentTime19 Apr 2010
     
    Hi!

    I used Bison for some projects, even if not recently, so some of my issues may be not longer valid.

    As for ATALAN, reasons, for not using LEX/Bison/YACC or whatever other tool are:

    - ATALAN grammar optionally uses indent to define code blocks, which complicates use of LEX
    - I have a vision of writing ATALAN in itself in some galaxy far, far away :-) Use of Bison would prevent me from doing so
    - I hate all kinds of code wizards as sooner or later I want to do something they do not know how to do (this may still happen, as ATALAN syntax is not finished yet)
    - custom syntax definitions are still considered (see Kutululu, for language based only on custom sytax) - although I wanted to be more 'traditional' with ATALAN

    Also syntax parser is really minor part of compiler development. Optimizer is much more complicated and takes major part of time. (First compiling version of ATALAN was written in two days, including lexer and parser. Since then, I'm basically rewriting the code so it allows for more optimizations.)

    However, I'm very glad someone is interested in the project :-)
    • 16:
       
      CommentAuthorjhusak
    • CommentTime20 Apr 2010
     
    bison nie jest jakimś tam wizardem, który generuje nie wiadomo co. Generuje automat skończony LALR(1) (taki, co do akcji musi mieć podgląd następnego leksemu, ale co najwyżej jednego). Czysty szybki kod w C.

    Optymalizator okienkowy? To takie coś, co przechodzi okienkiem po skompilowanym kodzie (po kilka rozkazów) i to optymalizuje. Zaletą jest olbrzymia prostota, wad nie ma. Okazało się w testach, że jest to jedna z lepszych i jednocześnie prostszych metod optymalizacji skompilowanego kodu. Kilka wzorców i kilka rezultatów, takie preg_replace.

    Co do nowych możliwości składni, to w bisonie się dodaje i już. Część wykonawcza jest już gdzieś wpisana w zapewne podobnej postaci.

    Co do reszty punktów nie dyskutuję, bo to kwestia gustu;)

    Chwali się podejście "szlifowania" - to jest takie twórcze i ma znamiona bycia odkrywcą.

    bison jest dla praktyków.
    • 17:
       
      CommentAuthorjhusak
    • CommentTime20 Apr 2010 zmieniony
     
    Ja tak sobie myślę, że najfajniejszy byłby język minimalistyczny w zapisie. Mało pisania, dużo funkcji, a jednocześnie, żeby to _przejrzyste_ było. I żeby kod był oszczędny.

    Może taki np. Whitespace
    ->link<-
    • 18:
       
      CommentAuthorlaoo
    • CommentTime20 Apr 2010 zmieniony
     
    Ja swoje parsery piszę za pomocą Gold Parsera ( ->link<- ).
    W skrócie: Builder na podstawie gramatyki (ala EBNF) generuje plik z tablicami stanów itd. dla leksera i parsera. Te tablice są już używane przez konkretny silnik napisany w dowolnym języku. Jest kilkadziesiąt implementacji. Nie widzę przeszkody aby nie mogła powstać jedna nawet na 6502 :)
    Builder jest na tyle elastyczny, że umożliwia pisanie gramatyk z wirtualnymi terminalami (czyli można mieć np. gramatykę wrażliwą na wcięcia (indent); jeśli tylko będzie się potrafiło takiego terminala rozpoznać, to jak wepchnie się go do silniczka, to reszta już sama się zrobi).
    • 19:
       
      CommentAuthorjhusak
    • CommentTime20 Apr 2010
     
    Fajny, tylko na razie tylko na Winowsy. Autor obiecał, że będą na *nix oraz źródła udostępni. Ale kiedy ...
    • 20:
       
      CommentAuthorlaoo
    • CommentTime20 Apr 2010
     
    Wine powinien poradzić sobie z wersją command-line.
    • 21: CommentAuthorrudla
    • CommentTime20 Apr 2010
     
    New version of ATALAN is on ->link<-

    - site includes some basic info on optimizer, backend
    - some examples were added including .asm and .xex

    - loop optimizations, and improved live variable analysis and constant folding and propagation

    I'm using loop_2sec and esieve as a benchmarks.

    ** loop_2sec

    see end of discussion in ->link<-

    Counts in ALTIRRA to 179704. I have added some experimental support for 3byte integers (increment, initializations - other operators are a matter of writing backend rules) and ATALAN can also print them nicely.

    ** esieve

    Compute prime numbers between 1..8192. This is to allow comparision of ATALAN and CC65 in article in FLOP53.

    ATALAN computes the primes in 27 ticks.
    CC65 in 40 ticks (test performed by Raster/C.P.U.).

    Note, that the ATALAN example does not use any 'tricks', it uses just simple array access, no pointer arithmetics.

    This is not the end :-) I want to extend my loop variable analysis to convert indexed array access to pointer array access.
    • 22:
       
      CommentAuthorCosi
    • CommentTime21 Apr 2010
     
    Amazing! :) I've never seen such construction as "for ... until ..." - really helpful. Besides, I love these indented blocks ;-)
    However I encountered a problem. When I tried to write a simple loop:
    for i : 5..10
    "[i]"

    the compiler crashed with an unhandled exception. This only happened when I wanted to print the iterated variable. The file esieve.atl where similar loop appears, was compiled successfully.
    Maybe that's because I run the compiler with wine...
    • 23: CommentAuthorrudla
    • CommentTime21 Apr 2010
     
    I will try to solve the error ASAP. Please be patient, as there is certainly lot of errors now. I need to write more examples and tests and stabilize the code.
    • 24: CommentAuthorrudla
    • CommentTime22 Apr 2010
     
    For Facebook users:

    ->link<-
    • 25: CommentAuthorrudla
    • CommentTime22 Apr 2010
     
    cosi: fixed version is online, your example should work :-)
    • 26:
       
      CommentAuthorjhusak
    • CommentTime22 Apr 2010
     
    @rudla, you have been given extraordinary boost!

    Keep on! With buggy lang nobody wants to code!
    • 27:
       
      CommentAuthorCosi
    • CommentTime23 Apr 2010
     

    rudla:

    cosi: fixed version is online, your example should work :-)

    Indeed :) Ok, some more issues:

    1) The compiler still crashes on such expression:
    for i : byte
    ...

    When I declare the variable before, it compiles successfully:
    i : byte
    for i
    ...


    2) How the hell can I execute procedures??? ;-) According to the reference, procedures are executed simply by typing their names. Such code:
    p1 : proc =
    "Test"

    p1

    gets compiled but doesn't work (there's no jsr in asm code).
    Besides I can't declare a procedure that receives parameters nor a typed procedure (p1 : word proc).

    3) What does the construction "var : type(x)" mean? Is it a synonym for array? I wasn't able to declare a variable that way.
    • 28: CommentAuthorrudla
    • CommentTime29 Apr 2010
     
    ad 2) New version fixes procedure call issues (optimizer was too agressive and removed the calls).

    ad 3) var:type(20) of byte declares array of byte with indexes 0..20 (i.e. 21 elements).

    There is also support for WHERE in loops (demonstrated in esieve.atl).
    • 29:
       
      CommentAuthorCosi
    • CommentTime29 Apr 2010
     
    One more bug ;-)
    I wrote a simple program:
    test : proc = "To jest test"

    test

    but the above code didn't compile. The compiler (MADS) wrote error message:
    beq done ;this is zero and there has been no char before - no output
    atari.asm (143) ERROR: Branch out of range by $0003 bytes
    bcs loop
    atari.asm (191) ERROR: Branch out of range by $0037 bytes

    When the code contains other "print" command, preceding or following the execution of test, it compiles successfully.

    One more question: could you mention the version of the compiler in the executable? It would come in handy :)
    • 30: CommentAuthorrudla
    • CommentTime30 Apr 2010
     
    Ha! It seems, we have discovered an error in MADS :-)
    The error is caused by -x switch used by ATALAN to let the MADS remove unused procedures. (Too agressive optimization - I know it very well :-)

    I found a way to rearrange the code so, that it works correctly. I will incorporate the fix in next version, which will be marked by release date.

    I also started a page ->link<- with release history.

    Thank you very much for testing. It motivates me to continue working on ATALAN.
    • 31:
       
      CommentAuthormiker
    • CommentTime24 Jul 2010
     
    Any chance for some manual for newbies? ;)
    • 32:
       
      CommentAuthorCosi
    • CommentTime24 Jul 2010
     
    I can contribute and also make the Polish translation :)
    • 33: CommentAuthorrudla
    • CommentTime24 Jul 2010
     
    I will try to write something.
    I would like to try to write some another simple game (boulder dash cames to mind) and comment it heavily.

    There is still lot of improvements to make in ATALAN, but i'm trying to set the priorities based on the real development.
    • 34: CommentAuthorrudla
    • CommentTime5 Aug 2010
     
    It is possible to write DLI and VBI in ATALAN now.
    See the interrupts example at ->link<-

    Other interrupts should be easy to add, as it is all done in language itself as definition of variables, macros and compiler rules.
    • 35:
       
      CommentAuthorCosi
    • CommentTime6 Aug 2010
     
    Great :) I'm having fun defining my own DLI's :-)
    A tutorial (or detailed reference) would be useful, though...
    • 36:
       
      CommentAuthorCosi
    • CommentTime6 Aug 2010 zmieniony
     
    Wait, the compiler doesn't want to add word variables. It says:
    error: no rule for translating instruction
    add c:0..65535, a:0..65535, b:0..65535


    PS. The same with multiplying (no matter if I multiply bytes or words).
    PS2. I guess it's not possible to iterate a "for" loop using a variable value as a boundary? I got:
    syntax error: Upper bound is not constant $
    • 37:
       
      CommentAuthorCosi
    • CommentTime6 Aug 2010
     
    One more question (I'm digging really deep into ATALAN) ;-)
    How can I write the contents of a text variable?
    I declare an array of bytes:
    a:array(0..19) of byte = "Test"

    Now I'd like to print it out:
    "Testing... [a]"

    But I'm not able to do so:
    error: no rule for translating instruction
    var_arg a


    PS. Loop statements like "break" and "continue" would come in handy. They may be easily implemented as labels, e.g.:
    loop:
    continue:
    ...
    BEQ continue
    ...
    BEQ break
    ...
    BEQ loop
    break:
    • 38:
       
      CommentAuthorCosi
    • CommentTime6 Aug 2010 zmieniony
     
    Erm, some more errors:
    1) Such code:
    const fnt:font = "font.fnt"
    CRSR@752:byte

    Won't get compiled. There are several error messages, depending on the order of declarations.

    EDIT: I found out that when there are empty lines between declarations, the program compiles successfully.

    2) I can't subtract a value of a variable from a number:
    COLPF(0) = 255 - VCOUNT

    gives:
    error: no rule for translating instruction
    sub COLPF(0), 255, VCOUNT


    PS. The compiler doesn't show numbers of buggy lines properly. I always get file.atl(1). (I guess that the "1" is the number of the line ;-))
    • 39: CommentAuthorrudla
    • CommentTime6 Aug 2010
     
    Wow. I obviously need somebody else to try to write some code in ATALAN to catch errors! Thank you for trying, hope you won't get too frustrated :-)

    I will try to solve all the reported error ASAP.

    line numbers: by strange conincidence, I discovered the same error today (problem was with UNIX line endings). It is solved now, I will post the patched version on web.


    writing text variables: There is no proper string handling yet, that is why it is not possible to write strings.
    • 40: CommentAuthornosty
    • CommentTime12 Aug 2010
     
    Nie potrafie sobie poradzic z banalna rzecza:
    Chce zrobic petle for od 0 do wartosci zmiennej (przekazanej jako parametr do procedury).

    Moglby ktos pomoc?
    thx
    • 41: CommentAuthornosty
    • CommentTime12 Aug 2010 zmieniony
     
    Probuje pisa prosta gre ale coraz bardziej sie zniechecam :(
    80% czasu trace na zgadywanie jak przerobic kod (poprawny!) zeby kompilator go zrozumial i zadzialal poprawnie.
    Zwykle dostaje przy kompilacji bledy assemblera.

    Przyklady:

    poz_z = pocz + yy * roz_x + xx

    dostaje bledy asemblera (3x ERROR: Undeclared label)

    ale zapis:

    poz_z = pocz
    poz_z = poz_z + yy * roz_x + xx

    juz jest przyjmowany

    =====

    _scr(10 + xx, 10 + yy) = znak

    powoduje blad asemblera (ERROR: Undeclared label _LBL3)
    ale:
    scr_xx = 10 + xx
    scr_yy = 10 + yy
    _scr(scr_xx, scr_yy) = znak

    dziala

    ======

    levmax:0..1

    const levrozmiar:array(levmax, 0..1 ) = (
    7, 6
    8, 7
    )

    rysuj_level:proc lev:byte =
    roz_x = levrozmiar(lev, 0)
    roz_y = levrozmiar(lev, 1)


    po wywoalniu:

    rysuj_level 1

    powoduje ze roz_x = 6 i roz_y = 6 (!!!)

    Ale juz dodatkowe podstawienie:

    levmax:0..1

    const levrozmiar:array(levmax, 0..1 ) = (
    7, 6
    8, 7
    )

    rysuj_level:proc lev:byte =
    lev2 = lev
    roz_x = levrozmiar(lev2, 0)
    roz_y = levrozmiar(lev2, 1)


    zwraca prawidlowe wartosci: roz_x = 6 i roz_y = 7

    =========

    Nie wiem czy ja czegos nie pojmuje, czy ten jezyk jest na etapie "wczesna alpha"?

    No zapalilem sie, ale tak sie nie da :(
    Cala energia idzie w bledy kompilatora...
    • 42: CommentAuthornosty
    • CommentTime12 Aug 2010 zmieniony
     
    Kolejny problem mam z taka konstrukcja:

    xx,yy = 0,0
    while xx < roz_x
    while yy < roz_y
    ;rozne instrukcje
    inc yy
    inc xx


    Petla zewnetrzna wykonuje sie tylko raz (a oczywiscie powinna wiecej razy)
    inc xx - zaleznie od wciecia albo nie wykonuje sie wcale albo jest wykonywane w wewnetrznej petli (razem z inc yy).
    • 43: CommentAuthorrudla
    • CommentTime12 Aug 2010 zmieniony
     
    @nosty:
    in this case you must initialize yy to 0 inside the inner loop
    xx =0
    while xx < roz_x
    yy = 0
    while yy < roz_y
    ;rozne instrukcje
    inc yy
    inc xx
    • 44: CommentAuthorrudla
    • CommentTime12 Aug 2010
     
    @nosty:

    ATALAN is indeed in alpha stage of development (as in work in progress). I didn't expect someone else than me writing a game in this stage of development.

    All the required features are obviously there, but ATALAN is far from being rock solid and some features, that had not been required yet are not implemented in backend.
    (It is usually quite easy to implement then and I believe any experienced assembler programmer would be able to expand the backend - anyone wants to help?)

    I am currently working (quite intensively in fact) on pruning as many errors as possible and adding as many error checks as possible.

    So I see that developing anything bigger in ATALAN must be frustrating experience now and I'm sorry, if I somehow made you think otherwise.

    If you however want to keep trying, feel free to send your code to my email and I will try to fix errors you encounter as fast as possible.
    I can even give you my ICQ number if it would help.
    • 45:
       
      CommentAuthorKaz
    • CommentTime12 Aug 2010
     

    rudla:

    So I see that developing anything bigger in ATALAN must be frustrating experience now and I'm sorry, if I somehow made you think otherwise.


    Don't be sorry - this is clear that Atalan is in development stage. I hope this great feedback from users will help you.

    rudla:

    ATALAN is indeed in alpha stage of development (as in work in progress). I didn't expect someone else than me writing a game in this stage of development.


    This is the power of people aggregated by this forum - they are really interested in Atari projects.

    BTW: it could be good to inform here from time to time about bigger update in language code or tutorial.
    • 46: CommentAuthornosty
    • CommentTime12 Aug 2010
     
    @Rudla - dziekuje za pomoc i wyjaśnienia. Mój angielski jest za słaby na długie dyskusje, ale widzę, że Ty świetnie rozumiesz polski. Spróbuję jednak skończyć prostą wersję gry. I będę raportował Ci na maila błędy jakie znajdę. Mam nadzieję, że to Ci pomoże.

    One important question: can I use loop: "for <var> <body>" where <var> is from 0 to variable value.
    Example:

    petla:proc counter:byte =
    for x:0..counter
    draw_block x

    I know that this don't work. But I need something like this...

    Now I use "while" command for this but "for" command should be better.
    • 47: CommentAuthornosty
    • CommentTime13 Aug 2010
     
    @rudla - fresh errors report ;)

    A loop in loop still don't work properly:

    Test it please:

    roz_y = 6
    roz_x = 8

    yy = 0

    while yy < roz_y
    xx = 0
    while xx < roz_x
    inc xx
    inc yy

    "xx after loops = [xx]"
    "yy after loops = [yy]"


    The results are:
    xx afrer loops = 8
    yy after loops = 8 (I expected 6)

    Second problem: the same code but without empty line befor printing works differently! I remember your exmplanations about blocks so block's limit should be indent only not empty line.

    So check it please:

    roz_y = 6
    roz_x = 8

    yy = 0

    while yy < roz_y
    xx = 0
    while xx < roz_x
    inc xx
    inc yy
    "xx after loops = [xx]"
    "yy after loops = [yy]"
    • 48: CommentAuthornosty
    • CommentTime17 Aug 2010
     
    Rudla wypuscil wczoraj nowa wersje kompilatora, po czym wyjechal na wakacje. Niestety u mnie ta nowa wersja nie dziala. Wogole. Program niczego nie kompiluje, niczego nie wyswietla.

    Mam wiec prosbe: o test - czy u Was dziala.
    I druga: o wrzucenie poprzedniej wersji kompilatora (tej z 7 sierpnia) bo swoja nieopatrznie nadpisalem, a ze strony autora mozna pobrac tylko najnowsza.

    Dzieki.
    • 49:
       
      CommentAuthorCosi
    • CommentTime17 Aug 2010
     
    Potrzebna jest nowa wersja pliku msvcr100.dll. Tutaj możesz ją ściągnąć.
    DLLa możesz wrzucić do katalogu bin albo do systemowego. Wtedy nowa wersja śmiga i nawet kompiluje programy :-)
    • 50: CommentAuthornosty
    • CommentTime17 Aug 2010
     
    Dzieki! Juz faktycznie dziala.
    Szkoda ze skompilowany program dziala inaczej niz skompilowany poprzednia wersją :D