flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
uart777 28 Mar 2013, 14:53
An example expression parser.
EXP^ASM converts a standard "Infix" expression to "Reverse Polish Notation" (RPN) then to ASM with machine code. Dis/assembles code as you type. Expression.INC uses a single-pass algorithm that produces 3+ times more effecient code than the popular "Let's Build a Compiler" tutorials by Jack Crenshaw (good introduction for beginners). ASM code must be rescanned and optimized (which is another subject that would take an entire book to explain considering the infinite number of ways that code can be written). No time for questions. ASM experience is assumed. Designed in 1024x600/768 resolution. Includes 2 examples that are not graphical. ![]() Download: http://sungod777.zxq.net/expression.zip
Last edited by uart777 on 27 Aug 2013, 03:19; edited 1 time in total |
|||||||||||
![]() |
|
baldr 28 Mar 2013, 15:08
uart777,
How about common subexpressions and such? ![]() |
|||
![]() |
|
baldr 28 Mar 2013, 15:38
uart777,
Constant expressions aren't good to show power of parser (they're constant and should be replaced with equivalent constants during compilation, right?). Show me parser that will replace 1+2+3+...+n with n(n+1)/2 (when n is a run-time value), and I'll eat my hat. ![]() Gauss was able to do that in his teen ages (as anecdote says). |
|||
![]() |
|
MHajduk 28 Mar 2013, 15:56
I like the whole idea but also agree with baldr that your expression parser would be far more usable if you would allow use of symbolic constants inside the input field.
![]() I've noticed an issue when I tried to enter some number of leading zeros before the digit. There is something that should be fixed, IMO (remove the unneeded leading zeros should be enough), see the attached screenshot: ![]() |
|||
![]() |
|
MHajduk 28 Mar 2013, 16:03
Another thing: seems that your expression parser doesn't allow to use of negative numbers? See the screenshot:
![]() |
|||
![]() |
|
MHajduk 28 Mar 2013, 16:09
Even use of parentheses doesn't help here:
![]() |
|||
![]() |
|
KevinN 28 Mar 2013, 16:52
it's cool how it is imo
|
|||
![]() |
|
HaHaAnonymous 28 Mar 2013, 17:32
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:14; edited 1 time in total |
|||
![]() |
|
baldr 28 Mar 2013, 20:13
HaHaAnonymous,
There is no specification, use the source, Luke. ![]() It's incorrect in common sense, yet it may be some obscure way to signify "too exact one". |
|||
![]() |
|
HaHaAnonymous 28 Mar 2013, 21:27
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:14; edited 1 time in total |
|||
![]() |
|
baldr 29 Mar 2013, 06:52
HaHaAnonymous,
OK, I'll explain. There is no specification this program adheres to, so the only chance to understand its behavior is to read program's source (in fact, it is even if specification exists). Though due to its highly macroed nature it's easier to use debugger. 1 to -119 translation is weird (and somewhat unstable), "too exact one" was intened pun, like 1.(0) |
|||
![]() |
|
uart777 29 Mar 2013, 07:41
KevinN: Thanks. Your inquiries about compiler creation are what motivated me to upload this. Writing an expression is, by far, the greatest challenge in creating a HL compiler and I don't think most programmers here realize this.
Sorry, no time to explain. Last edited by uart777 on 07 Aug 2013, 19:14; edited 2 times in total |
|||
![]() |
|
uart777 29 Mar 2013, 07:55
[ Post removed by author. ]
Last edited by uart777 on 07 Aug 2013, 19:18; edited 1 time in total |
|||
![]() |
|
baldr 29 Mar 2013, 09:06
uart777 wrote: Wrong Oscar Wilde wrote: I'm too old to know everything. ![]() uart777 wrote: Any expression parser - whether it produces a constant or variable result - can be replaced with [m] and runtime instructions. uart777 wrote: In addition, please note that with [m] operands, HL compilers generally assume that function calls alter all registers and volatile variables (example, a pointer to system clock) can change from one instruction to the next. Please, tell me why pointer to system clock should be considered as volatile? SMP, or maybe the value it's pointing to? uart777 wrote: Sorry, no time to explain. ![]() P.S. !#name.$type='c' in LANGUAGE.INC::function macro should be !#name#.$type='c', probably. |
|||
![]() |
|
tthsqe 29 Mar 2013, 10:04
Quote: How about common subexpressions and such? if the code contains no branches this is a rather straightforward procedure I am trying to implement general partial redundancy eliminations on jumpy code (for my calculator) and it is messy... |
|||
![]() |
|
HaHaAnonymous 29 Mar 2013, 13:33
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:14; edited 1 time in total |
|||
![]() |
|
AsmGuru62 29 Mar 2013, 14:04
It IS otherwise!..
|
|||
![]() |
|
revolution 29 Mar 2013, 14:31
Reading and learning another persons macros takes a lot of time and effort. I also find it easier to read the actual assembly since I already know and understand that without having to refer to other things. I don't feel it is good use of my time to decode a set of complex macros for a one time task.
[rant]Just like with custom UI layout and format. So much time wasted trying to find the right button. Why do music player programmers (and now Windows 8) all seem to feel the need to build completely unfamiliar skins? All I need is basic menus and buttons. I don't need them all fancy colours, or weird shapes and sizes, in crazy positions, and other what-not.[/rant] |
|||
![]() |
|
HaHaAnonymous 29 Mar 2013, 15:33
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:09; edited 1 time in total |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.