Ceci est une ancienne révision du document !
State Machine
antlr
video: http://www.youtube.com/watch?v=q8p1voEiu8Q&feature=youtu.be
exemple d'utilisation : http://www.youtube.com/watch?v=Bhnw_vexdAI&list=PLCB70903D812AD11A
http://www.antlr.org/wiki/display/ANTLR4/Getting+Started+with+ANTLR+v4
il faut java 1.6: http://support.apple.com/kb/dl1359?locale=en_US
choix de la version de java: http://superuser.com/questions/490425/how-do-i-switch-between-java-7-and-java-6-on-os-x-10-8-2
/usr/libexec/java_home -v 1.6.0_26 --exec javac -version
pour savoir ou est installé la version 1.6 de java
/usr/libexec/java_home -v 1.6.0_26
pour lancer java 1.6
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -version
du coup les alias à créer pour antlr:
export CLASSPATH=".:/usr/local/lib/antlr-4.0-complete.jar:$CLASSPATH" alias antlr4='/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -jar /usr/local/lib/antlr-4.1-complete.jar' alias grun='/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java org.antlr.v4.runtime.misc.TestRig'
cd /tmp vim Hello.g4 // Define a grammar called Hello grammar Hello; r : 'hello' ID ; // match keyword hello followed by an identifier ID : [a-z]+ ; // match lower-case identifiers WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines antlr4 Hello.g4 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/javac Hello*.java
grammaire antlr4 pour C: https://github.com/antlr/grammars-v4/commit/15df18159653f7ae2963cc73bec7d2b8939a9363
grammaire antlr3 pour vhdl: http://www.jguru.com/forums/view.jsp?EID=1382922
http://www.antlr3.org/grammar/list.html
http://www.antlr3.org/grammar/1086696923011/vhdlams/
http://www.antlr3.org/grammar/1086696923011/vhdlams/vams.g
parsing vhdl is very hard: http://eli.thegreenplace.net/2009/05/19/parsing-vhdl-is-very-hard/