aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdgar-Alexis-Lopez-Martinez <83847738+Edgar-Alexis-Lopez-Martinez@users.noreply.github.com>2022-11-07 21:09:47 -0600
committerGitHub <noreply@github.com>2022-11-07 21:09:47 -0600
commit51c4a8c64d713b2b2e1d74d528744f2c06dd1fd6 (patch)
tree2fffc753e46867afcf8cb0c44b990eb95a8ab6c0
parent8580f1cdaa6d6ba579a45401bc7b07c834e0b29a (diff)
downloadjavanol-51c4a8c64d713b2b2e1d74d528744f2c06dd1fd6.tar.gz
javanol-51c4a8c64d713b2b2e1d74d528744f2c06dd1fd6.tar.bz2
javanol-51c4a8c64d713b2b2e1d74d528744f2c06dd1fd6.zip
Create automata_identificadores.py
-rw-r--r--automata_identificadores.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/automata_identificadores.py b/automata_identificadores.py
new file mode 100644
index 0000000..5e95429
--- /dev/null
+++ b/automata_identificadores.py
@@ -0,0 +1,37 @@
+class automata_identificadores:
+ int stateN = 0
+ int isAccepted(char str[]):
+
+ int len = len(str)
+
+ for i in len:
+ if (stateN == 0):
+ start(str[i])
+ else:
+ if (stateN == 1):
+ state1(str[i])
+ else:
+ return 0
+
+ if (stateN == 1):
+ return 1
+ else:
+ return 0
+
+ def start(char c):
+ if (isalpha(c) or c == '_'):
+ stateN = 1
+ else:
+ stateN = -1
+
+ def state1(char c):
+ if (isalpha(c) or c == '_' or isdigit(c)):
+ stateN = 1
+ else:
+ stateN = -1
+
+ bool no_es_main(char* token):
+ if (isAccepted(token))
+ return true
+ else:
+ return false