Git Product home page Git Product logo

complier's Introduction

#BOOM LANGUAGE @(Defined by:|Aicitel|Ncnxj5|HaperJJ )[Complier| @SJTU_SE|]

Entrance : The function : fuse <<<<<<< HEAD

  • Def.

DEF fuse() AS NUM! { }!

  • **Meaning: **A fuse is a device on a bomb or firework which delays the explosion so that people can move a safe distance away

MORE [USAGE]:

VARIABLE DEFINE

DEF |VARIABLE NAME| AS |TYPE| !

DEF i AS NUM!

DEF f AS FLOAT!

DEF c AS CHARACTER!


FUNCTION DEFINE

DEF |FUCTION NAME| ( |PARAMETER| ) AS | FUNCTION TYPE | { |BODY| }!

DEF func() AS NUM{...}!

**Meaning: **


FUNCTION CALL

|FUCTION NAME|( |PARAMETER| )!

func(i,j)!

**Meaning: **


LET

LET |VARIABLE NAME| AS |VALUE|

LET i AS 1!

LET a AS func(1,2)!

LET m AS 2+b!

**Meaning: **


IF

?( |CONDITION| ){ |BODY| }!

?( line[i]=j ){ printcha(81)! }!

**Meaning: **


LOOP

LOOP( |CONDITION| ){ |BODY| }!

LOOP(a<n) { LET a AS a+1! }!

**Meaning: **


BREAK

BOOM!

LOOP(a<n) { LET a AS a+1! BOOM! }!

**Meaning: **


Demo: Eight Queen

	DEF line AS NUM[8]!
	DEF answer AS NUM!
	
	DEF show() AS NUM    # the func for show the Queens
	{ 
		DEF i AS NUM! 
		DEF j AS NUM! 
		LET i AS 0! 
		LET j AS 0! 
		LOOP(i<8) 
		{  
			LOOP(j<8)  
			{
			
				 ?(line[i]=j             ) {printcha(81)!}!#print 'Q'
				 ?(line[i]>j OR line[i]<j) {printcha(42)!}!#print '*'  
				  
				 LET j AS j+1! 
			}!  
				 LET j AS 0!  
				 printcha(10)!  # print '\n'
				 LET i AS i+1! 
		}! 
		LET answer AS answer+1! 
		printnum(answer)! 
		printcha(10)! 
		inputcha()! 
		RET 0!
	}!
	
	DEF judge(NUM n) AS NUM
	{ 
		DEF i AS NUM! 
		LET i AS 0! LOOP(i<n) 
		{
			  ?(line[n]=line[i]    ) {RET 1!}!  
			  ?(line[n]-n=line[i]-i) {RET 1!}!  
			  ?(line[n]+n=line[i]+i) {RET 1!}!  
			  LET i AS i+1! 
		}! 
		RET 0!
	}!
	
	DEF control(NUM n) AS NUM
	{ 
		DEF k AS NUM! 
		LET k AS 8! 
		DEF temp AS NUM! 
		LET line[n] AS 0! 
		LOOP(line[n]<k) 
		{  
			LET temp AS judge(n)!  
			?(temp =0)  {?(n>7 OR n<7){control(n+1)!}!
			?(n=7    )  {show()!}!  
		}!  
		LET line[n] AS line[n]+1! }! 
		RET 0!
	}!
	
	DEF fuse() AS NUM{ control(0)! RET 0!}!
	# fuse ,the main entrance to the bomb :)
	@BOOM!

Result: : Eight Queen

	...
	Q*******
	******Q*
	***Q****
	*****Q**
	*******Q
	*Q******
	****Q***
	**Q*****
	3
	...

MASM: Microsoft MASM 6.1 Programmer's Guide TIPS:MASM in CMD

;ml /c /coff a.asm ;link /subsystem:windows a.obj

.386 .model flat,stdcall 
option casemap:none 
include e:\masm32\include\windows.inc 
include e:\masm32\include\user32.inc 
includelib e:\masm32\lib\user32.lib 
include e:\masm32\include\kernel32.inc 
includelib e:\masm32\lib\kernel32.lib 
.data 
szCaption db 'A MessageBox',0 
szText db 'Hello!',0  
.code 
start:   
	invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK   
	invoke ExitProcess,NULL 
end start

ml /c /coff a.asm link /subsystem:console a.obj

.386 
.model flat,stdcall
include  e:\masm32\include\msvcrt.inc
includelib e:\masm32\lib\msvcrt.lib

.data 
	szFmt db 'HelloWorld -1:%d| ', 0

.code

main proc 
	mov eax,-1 
	invoke crt_printf, addr szFmt, eax 
	invoke crt_scanf    
	ret
main endp

end main

contrust

complier's People

Contributors

ncnxj5 avatar

Watchers

James Cloos avatar hcz avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.