| | Submitted on: 4/14/2002 7:42:19 PM
By: Jared Bruni
Level: Advanced User Rating:
By 26 Users Compatibility:Microsoft Visual C++
Users have accessed this article 1518 times. | (About the author) |
| | my very first attempt at writing a language translater. A very basic language that does input and output as well as operations on variables. Translates to C then shells to gcc to compile. For windows users comes with gcc, I am going to make another pass for variable checks for a line by line print out for debugging so sometimes you have to use gcc 's errors to fix your code. | |
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. |
my very first attempt at writing a language translater. A very basic language that does input and output as well as operations on variables. Translates to C then shells to gcc to compile. For windows users comes with gcc, I am going to make another pass for variable checks for a line by line print out for debugging so sometimes you have to use gcc 's errors to fix your code.
instructions
; comments
mov dest,from
print what
input var
pause 0
return 0
inc var
dec var
add var,var
sub var,var
mul var,var
div var,var
and var,var
or var,var
xor var,var
not var,var
cmp var,var
jmp label
jne label ; !=
je label ; ==
jge label ; >=
jg label ; >
jl label ; <
jle label ; <=
; intro to variables
mas ProgramName {
var
{
var& x := 0 ; integer
var$ s := "str" ; constant string
var$ str ; string
var# real := 0 ; double
}
begin {
start:
print "hello world\n"
print s
print str
}
}
; simple loop
mas object {
var {
var& x := 0
}
begin {
start:
inc x
print "hello world"
cmp x,10
jne start
}
}
; math
mas math {
var {
var& x := 100
var& y := 100
var& z := 25
var& counter := 0
}
begin {
start:
add x,y
sub x,z
mul x,z
div z,5
xor x,y
and y,z
inc counter
cmp counter,10
jne start
}
}
Screen Shots
Download
windows users , for Microsoft visual C++ here
run masasm.exe to compile your programs with the arguments
masasm script.masasm program.exe
| |
Other 273 submission(s) by this author
|
|
|
Report Bad Submission |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
4/14/2002 7:54:54 PM:Jared Bruni this is just beta 1
|
4/14/2002 8:27:19 PM:Joshua Nixon Very well done i look forward to the
full or better version, 5 from me.
|
4/14/2002 11:03:16 PM:MOV ax bx whoa sweet :D
|
4/15/2002 9:59:30 AM:matt Cool!, five votes from me!
|
5/28/2002 2:20:27 AM:Kyle LaDuke wow. that's all I really need to say
about this. It's 9.27 megs but it was
worth the download even on my 28.8
modem. That must have taken forever to
write.. dang man.. its cool
|
5/29/2002 7:55:23 PM:James C schweet.................
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
|