Context free grammar compilers
I wrote it in C++ with a context-free grammar parser called St-Jean developed by my CRIM teacher Claude Del Vigna.
I never found another so simple to use parser. I mean, look at ANTLR. So powerful. But so complicated. And now my main language of choice is Ruby. ANTLR can compile and generate Ruby, but i is painful. Then Ruby has Treetop. But I never got to use it due to its very light documentation. Well, the search is over, meet Parslet !
Parslet is so cool
OK, I don't want to write another article about it. Just read that:
Calculette
# Arithmetic
a = 1
b = a+2
c = a/b # a is casted to floated first
# Functions
def cube(a)
a*a*a
endf
# call the defined function
a = cube(5) + 2 # => 127
Developing Calculette is so fun ! But now what ?
Ideas ?
I don't know what to do from there :)
Maybe I will use it to write a programming language that ease the development of artificial intelligences ? Or a Ant game with scripting ? I don't know yet, any idea welcome :)
2 comments:
En me renseignant sur parslet, je suis tombé sur cette entrée de blog. J'ai essayé votre programme calculette, mais il y a un problème: 5-3-2 = 4 !?
(je n'ai pas fait d'entrée dans github car je n'ai pas de compte)
En effet, il y a un problème :)
Post a Comment