flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > High Level Languages > cicada-nymph

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
cicada-nymph
the little nymph is for teaching purpose only

it reuses the code and idea
of the early version of cicada-language
to teach my friends
how to implement a interpreter
of a simple programming language

I will use assembly language (FASM for x86-64)
to implement the interpreter
the programming language to be implemented
is a threaded-code based (Forth-like) language

two versions of the interpreter is implemented
one for linux
one for windows



to assemble it

1. download FASM
from :
http://flatassembler.net/
or :
https://github.com/the-little-language-designer/fasm

2. choose your platform
by editing the first few lines of the source code
if you are using linux :
linux? equ yes
windows? equ no
if you are using windows :
linux? equ no
windows? equ yes

3. assemble the program by the following one way or another
the command line interface of fasm :
fasm -m 500000 cicada-nymph.fasm
the fasm IDE (windows only) :
File -> Open -> (choose the file)
Options -> Compiler setup -> (set Memory to : 524288)
Run -> Compile
(output file will be saved in where the source file is)



the code of this program can be download from :
https://github.com/the-little-language-designer/cicada

to track todos, bugs, feature requests, and more
you can create an issue here :
https://github.com/the-little-language-designer/cicada/issues

_________________
the world is so often too complicated for the rules we make to keep it orderly.
https://github.com/xieyuheng


Last edited by xyh on 23 Apr 2015, 18:27; edited 1 time in total
Post 15 Mar 2015, 19:14
View user's profile Send private message Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
Post 18 Mar 2015, 12:51
View user's profile Send private message Reply with quote
nop



Joined: 01 Sep 2008
Posts: 167
Location: right here left there
beware everyone this websites use lots of cpu time and maybe chews up memory with firefox Sad
Post 19 Mar 2015, 04:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14505
Location: WTC Building 7

nop wrote:
beware everyone this websites use lots of cpu time and maybe chews up memory with firefox Sad

Turn off your JS. Don't let random websites run arbitrary code on your machine.


Last edited by revolution on 19 Mar 2015, 08:59; edited 1 time in total
Post 19 Mar 2015, 08:13
View user's profile Send private message Visit poster's website Reply with quote
nop



Joined: 01 Sep 2008
Posts: 167
Location: right here left there
i already have java disabled for a long time
Post 19 Mar 2015, 08:55
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14505
Location: WTC Building 7
I don't see any abnormal effect on my FF. Perhaps you have some other issue?
Post 19 Mar 2015, 08:59
View user's profile Send private message Visit poster's website Reply with quote
nop



Joined: 01 Sep 2008
Posts: 167
Location: right here left there
unlikely that we have the same firefox version with the same setup running on the same os so maybe you have some other issue also Wink
Post 19 Mar 2015, 09:31
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria

Quote:
This also served as the material of an experimental assembly course, which I am teaching now in SUN YAT-SEN university of China Guangzhou;



The FASM popularity in China universities is pretty interesting. Maybe someone have to translate the manual in Mandarin? Smile Or someone has already done it?
Post 19 Mar 2015, 09:37
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14505
Location: WTC Building 7

nop wrote:
unlikely that we have the same firefox version with the same setup running on the same os so maybe you have some other issue also Wink

Okay maybe I do. And if I do have some issue then it is a good one that allows me to view pages without excessive CPU or memory usage.
Post 19 Mar 2015, 10:00
View user's profile Send private message Visit poster's website Reply with quote
codestar



Joined: 25 Dec 2014
Posts: 254
Hi. In your code...

Code:
if linux? eq yes

define sys_6_r8  r8
; ...

Error. equ/define can't be inside "if", it will always get processed. Use match...

Code:
define os linux
; ...
define m 0 ; no match
match =linuxos {
  ; …
  define m 1 ; yes, match
}
match =0 \
  =windowsm os { ; else match. m=0
  ; ...
}

But you can compare symbolic constants with "if eq" and "if ~eq":

Code:
if m eq 0
 'Error' ; intentional
end if


Quote:
to teach my friends

Smile Cool
Post 20 Mar 2015, 09:42
View user's profile Send private message Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
an update of the website :
it is an incremental tutorial now
to teach you how to implement a simple language's interpreter in FASM
http://the-little-language-designer.github.io/cicada-nymph/intro/contents.html
there are English documentations for it too

only two part of the course is written in Chinese
1. notes computer architecture
2. basic assembler knowledge and the usage of FASM
so, if you can read English
then you will not miss anything important


@nop about the page loading problem :
loading is slow
that is because of that the Chinese font is big (about 5M)


@codestar about my misunderstanding of "if" :
thank you very much ^-^
I will fix this problem latter
Post 23 Mar 2015, 06:18
View user's profile Send private message Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
by the way
the incremental approach of the tutorial is learned from
<An Incremental Approach to Compiler Construction> -- Abdulaziz Ghuloum
https://github.com/namin/inc
http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf
Post 23 Mar 2015, 06:24
View user's profile Send private message Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
and I meet problems when runing the windows version of the interpreter.

on some windows machine it works fine

while on other windows machine it does not
in this case
a cmd window will appear
and disappear immediately


I meet the same problem when try to run the cmd version of FASM on windows
fasmw.exe always works fine
but fasm.exe meets the same problem as cicada-nymph.exe


any ideas ?
Post 23 Mar 2015, 08:45
View user's profile Send private message Reply with quote
CampTheBoss



Joined: 02 Feb 2015
Posts: 42
Location: A chair
run it in cmd.exe Idea
Post 26 Mar 2015, 20:15
View user's profile Send private message Send e-mail Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
@CampTheBoss

in the case of running them in cmd.exe

on some windows machine it works fine

while on other windows machine it does not
in this case
nothing will happen
just like you type a <return> in to the cmd
Post 26 Mar 2015, 21:59
View user's profile Send private message Reply with quote
CampTheBoss



Joined: 02 Feb 2015
Posts: 42
Location: A chair
Umm.. It might be a DOS application which 64 bit windows cant run
Post 27 Mar 2015, 07:06
View user's profile Send private message Send e-mail Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
@CampTheBoss

it is the FASM windows version
and the interpreter written by me for 64-bits windows
that are meeting this problem
Post 27 Mar 2015, 15:44
View user's profile Send private message Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
@codestar

and I found that barcket : { } in Fasm
can not be nested
I consider this a bug
Post 30 Mar 2015, 04:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14505
Location: WTC Building 7

xyh wrote:
and I found that barcket : { } in Fasm
can not be nested
I consider this a bug

Use the backslash.

Code:
macro x {
 rept 3 \{
  ;do something
 \}
}

Post 30 Mar 2015, 04:14
View user's profile Send private message Visit poster's website Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
@revolution

thanks
is it one-level one-backslash ?
so ::
{
\{
\\{
\\}
\}
}

it would be nice if Fasm can handle nested barcket without using backslash.
why it can not ?
Post 30 Mar 2015, 20:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.