very,first,attempt,writing,language,translate
Quick Search for:  in language:    
very,first,attempt,writing,language,translate
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
C/ C++ Stats

 Code: 451,578 lines
 Jobs: 605 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for C/ C++.
Visual Pi Hex
By jo122321323 on 8/25


Click here to see a screenshot of this code!ShortCutSample
By Massimiliano Tomassetti on 8/25

(Screen Shot)

AnPMoneyManager beta
By Anthony Tristan on 8/24


A calculator (english/polish )
By Tom Dziedzic on 8/24


MMC (Mouse Move Counter)
By Laszlo Hegedüs on 8/24


Text-DB
By Jerome A. Simon on 8/24


JDos
By Jerome A. Simon on 8/23


Game 1945X
By Ozgun Harmanci on 8/23


Find hidden "back streamed" files on NTFS partitions. This code is a must for sec consultants.
By Israel B. Bentch on 8/22


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

masasm C preproccescor

Print
Email
 

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
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
4/14/2002 7:54:54 PM:Jared Bruni
this is just beta 1
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/14/2002 8:27:19 PM:Joshua Nixon
Very well done i look forward to the full or better version, 5 from me.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/14/2002 11:03:16 PM:MOV ax bx
whoa sweet :D
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/15/2002 9:59:30 AM:matt
Cool!, five votes from me!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/29/2002 7:55:23 PM:James C
schweet.................
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | C/ C++ Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.